I have a problem with stylize buttons in bootstrap.
<div class="btn-group">
<button class="btn btn-midd">Link</button>
<button class="btn btn-midd dropdown-toggle">
<span class="icon-download-alt icon-gray"></span>
</button>
</div>
I want to change "icon-gray" to "icon-blue". Of course i have different image (and class which change backround-image). Icon-blue should be change on hover.
Thanks for help.
CSS:
.icon-blue {background-image: url("../img/glyphicons-halflings-blue.png");}
.icon-download-alt {background-position: -408px -96px;}
Here an example :

.icon-download-alt:hover {background-image: url("../img/glyphicons-halflings-blue.png");}
.icon-download-alt {background-position: -408px -96px;}
You can do this with jQuery easily employing the .hover() method:
<script type="text/javascript">
$(document).ready(function() {
$("span.icon-gray").hover(
function () {
$(this).removeClass("icon-gray");
$(this).addClass("icon-blue");
},
function () {
$(this).removeClass("icon-blue");
$(this).addClass("icon-gray");
}
);
});
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With