编辑:我遗漏了}); 最后,感谢 Petr 提示我错误
我有以下 HTML 代码:
<a href='#' class='button_flat'> Why Choose Us </a>
<div class='whyus'> Lorem Ipsum </div>
这是我的 jQuery
$(document).ready(function(){
$(".button_flat").click(function(){
$(".whyus").slideDown();
});
CSS
.button_flat {
border:0px;
background: #34495e;
color: white;
padding-top:10px;
padding-bottom:10px;
text-decoration:none;
padding-left:15px;
padding-right:15px;
}
.whyus {
display:none;
}
我不知道为什么代码不起作用。如果有人能帮助我,我将不胜感激。
最佳答案
您忘记关闭 $(document).ready
,添加 });
到脚本的末尾,它会正常工作:
$(document).ready(function () {
$(".button_flat").click(function () {
$(".whyus").slideDown();
});
});
jsFiddle here
关于javascript - jQuery slideDown,不处理链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18171403/