我有以下代码:
<a href="main.html" class="admin"><div class="buttonlabel">Admin</div></a>
和CSS
a.admin
{
display:block;
text-decoration:none;
float:left;
background: transparent url(./images/adminnormal.png?rand=628) no-repeat top center;
height:75px;
width:75px;
margin:5px;
outline: #00FF00 dotted thick;
}
上面的代码有这样的输出:
我希望仅当用户单击该链接 (onclick
) 时才显示该链接的轮廓。有什么想法吗?
最佳答案
HTML:
<a href="main.html" class="admin"><div class="buttonlabel">Admin</div></a>
CSS:
a.admin
{
display:block;
text-decoration:none;
float:left;
background: transparent url(./images/adminnormal.png?rand=628) no-repeat top center;
height:75px;
width:75px;
margin:5px;
}
a.admin.act{outline: #00FF00 dotted thick;}
jQuery:
$('.admin').click(function(){
$(this).addClass('act');
})
关于jquery - 单击大纲?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6370050/