jquery - 单击大纲?

标签 jquery html css

我有以下代码:

<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;
}

上面的代码有这样的输出:

enter image description here

我希望仅当用户单击该链接 (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/

相关文章:

jquery - 在 li 元素上搜索字符串,如果找不到则隐藏 lionly 类

javascript - Vue.js:将变量连接到图像 URL

html - DIV 未显示在 p 标签内

javascript - 滚动到一个 Dom 对象位置然后做一些事情

javascript - 宝丽来画廊插件中的 jQuery 上一个/下一个按钮

javascript - 导航中两个元素的背景颜色

javascript - 如何在单击按钮时动态更改所选文本的颜色?

css - CSS 内容的图像矩阵样式转换?

html - 包装内的内容对齐

javascript - 无法在 jQuery 选择器中使用变量