Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Bootstrap buttons

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 :

enter image description here

like image 334
Michal Avatar asked Sep 01 '26 21:09

Michal


2 Answers

.icon-download-alt:hover {background-image: url("../img/glyphicons-halflings-blue.png");}
.icon-download-alt {background-position: -408px -96px;}
like image 151
Joe Frambach Avatar answered Sep 04 '26 21:09

Joe Frambach


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>
like image 23
Leniel Maccaferri Avatar answered Sep 04 '26 22:09

Leniel Maccaferri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!