简体   繁体   中英

How to change an image when active to a seperate image?

I would like to do something similar to what was posted here...

Make Twitter Bootstrap navbar link active

Except instead of an item on the navbar becoming bolded, I would like it to use another image when active. From this...

之前

to this...

后

In the example link you posted, all they're doing is adding a CSS .active class to the active link. If you do the same and have the active class being added to the correct element, you can do something in the css like,

.active{
    background: url('path/to/image.jpg') no-repeat;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM