使用Jquery的可扩展Div
我有一个网站(lowrateadvisor.com),我正在努力在页面顶部设置一个可扩展的div。我可以让它在jsfiddle.net/3shEE/95/中运行,只是不能在站点上运行。非常感谢您的帮助使用Jquery的可扩展Div,jquery,css,Jquery,Css,我有一个网站(lowrateadvisor.com),我正在努力在页面顶部设置一个可扩展的div。我可以让它在jsfiddle.net/3shEE/95/中运行,只是不能在站点上运行。非常感谢您的帮助 CSS #expandable a{ color:#fff; text-decoration:underline; } #expandable a:hover{ color:#fff; text-decoration:none; } #expandable { width: 100%;
CSS
#expandable a{
color:#fff;
text-decoration:underline;
}
#expandable a:hover{
color:#fff;
text-decoration:none;
}
#expandable {
width: 100%;
height:35px;
background: transparent;
overflow: hidden;
background:#000;
color:#fff;
font-size:11px;
text-align:center;
}
#expandable.dropped {
background: #666;
color: white;
border-bottom: 1px solid #111 }
#expandable span {
display: block;
width: 100%; height: 50px;
line-height: 50px; text-align: center;
cursor: pointer;
}
#expandable ul {
width: 100%;
}
HTML
看不到任何打字错误。。。。只是一个语法错误:第67行的非法字符 尝试使用jquery 1.8.2和以下内容:
<script type="text/javascript">
$(document).ready(function () {
$("#expandable").hover(function() {
$(this).stop().animate({"height":"200px"},1000).addClass("dropped");
}, function() {
$(this).stop().animate({"height":"35px"},1000).removeClass("dropped");
});
});
</script>
$(文档).ready(函数(){
$(“#可扩展”).hover(函数(){
$(this.stop().animate({“height”:“200px”},1000).addClass(“droped”);
},函数(){
$(this.stop().animate({“height”:“35px”},1000).removeClass(“drop”);
});
});
从JSFIDLE复制代码时,有时会发生这种情况
jQuery代码的最后一个分号(有时是倒数第二个分号)作为非法字符复制。尝试删除最后一行(代码>)代码>并手动重新键入。您的代码中有一些打字错误,这就是为什么它会给出“非法字符”的错误。重新输入代码,不要复制粘贴。我真的需要帮助。任何帮助都将不胜感激。@Kundan-谢谢,我将尝试一下。我有特别的箭,这会成为一个问题吗?@kundan-谢谢,但这对我不起作用。我使用相同版本的jquery安装了一个滑块,这可能是问题所在吗?您缺少一个});在脚本的最后(在网页上)。谢谢大家。我让它工作了。我必须移除滑块才能让它工作。谢谢大家。我让它工作了。我必须移除滑块才能让它工作。
$("#expandable").hover(function() {
$(this).stop().animate({"height":"200px"},1000).addClass("dropped");
}, function() {
$(this).stop().animate({"height":"35px"},1000).removeClass("dropped");
});
<script type="text/javascript">
$(document).ready(function () {
$("#expandable").hover(function() {
$(this).stop().animate({"height":"200px"},1000).addClass("dropped");
}, function() {
$(this).stop().animate({"height":"35px"},1000).removeClass("dropped");
});
});
</script>