工具栏图标切换
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了工具栏图标切换相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> div{ background-repeat:no-repeat; background-size: 100% 100%; float:left; width:2rem; height:2rem; margin-right:1rem; } .one{ background-image:url("../images/statistic.png"); } .one.active{ background-image:url("../images/statistic-c.png") } .two{ background-image:url("../images/recommend.png") } .two.active{ background-image:url("../images/recommend-c.png") } .three{ background-image:url("../images/reward.png") } .three.active{ background-image:url("../images/reward-c.png") } </style> </head> <body> <div class="one active"></div> <div class="two"></div> <div class="three"></div> </body> <script type="text/javascript" src="../js/jquery-1.7.2.js"></script> <script> $("div").click(function(){ $(this).addClass("active"); $(this).siblings().removeClass("active") }) </script> </html>
以上是关于工具栏图标切换的主要内容,如果未能解决你的问题,请参考以下文章