I'm new to this, so I hope this is a straightforward question. I'd like to use the bgtoggle
class as a button to switch the background color of the metro
class. I know I'm doing something wrong because it's not working as expected. Any help would be greatly appreciated. Thank you!
HTML:
<div class="bgtoggle">
</div>
CSS:
.bgtoggle{
position: absolute;
width: 56px;
height: 43px;
right:65px;
top:170px;
color:#fff;
font-size: 3em;
cursor:pointer;
z-index:9999;
background-image: url("../images/mthc/bgtoggle.png");
background-size: 100%;
}
.bgtoggle:hover{
background-image: url("../images/mthc/bgtoggle2.png");
}
Here's my attempt at jQuery, but it's not working as intended:
$('.bgtoggle').toggle(function () {
$(".metro").css('background', '#000');
}, function () {
$(".metro").css('background', '#fff'));
}