日期:2014-05-17 浏览次数:20697 次
$(".myclip-item-link").mouseover(function() { // 鼠标移到超链接上时,加上边框 $(this).addClass("myclip-item-over"); }).mouseout(function() { // 鼠标移出超链接时,去掉边框 $(this).removeClass("myclip-item-over"); }).click(function(){ // 点击超链接后,加上高亮边框(同时去掉其它超链接的高亮边框) $(".myclip-item-link").removeClass("myclip-item-highlight"); $(this).addClass("myclip-item-highlight"); });
<style> .myclip-item-link { display: block; height: 105px; outline-style: solid; outline-color: #AAAAF0; outline-width: 1px; } .myclip-item-over { outline-style: solid; outline-color: #FFAAA0; outline-width: 2px; } .myclip-item-highlight { outline-style: solid; outline-color: #FFAAA0; outline-width: 3px; } </style>
... ... ... <ul> <li> <div class="myclip-item"> <a href="javascript:void(0);" class="myclip-item-link"> <div> <img src="img/1.gif" alt="" width="75" height="75"> </div> <div class="myclip-item-desc"> 2012/08/22 17:42:30 </div> </a> </div> </li> <li> <div class="myclip-item"> <a href="javascript:void(0);" class="myclip-item-link"> <div> <img src="img/2.jpg" alt="" width="75" height="75"> </div> <div class="myclip-item-desc"> 2012/08/22 17:42:30 </div> </a> </div> </li> </ul> ... ... ...