[英]Problems with jQuery slideToggle Function
Please help me find the problem with this code. 请帮助我找到此代码的问题。 I am trying to create a simple slideToggle element!
我正在尝试创建一个简单的slideToggle元素! I tried this first:
我首先尝试了这个:
$("..").slideToggle(..,..,..)
My current code looks like this: 我当前的代码如下所示:
$(document).ready(function () { $("#Layer13copy2").click(function () { $("#toggle").animate({ height: 'toggle' }); }); });
#Layer13copy2 { left: 13.85%; top: 398px; position: absolute; width: 892px; height: 37px; z-index:5; background:url('../images/slidet.png') 45%; background-repeat:no-repeat; background-size:101.4% 101%; } #toggle { z-index: 4; background-color: #3a97b1; display: block; left: 13.85%; top: 39.37%; position: absolute; width: 71.95%; height: 17%; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <div id="Layer13copy2"></div> <div id="toggle"></div>
$(document).ready(function(){ $('#toggle').animate({ height : 'toggle' }); $("#Layer13copy2").click( function(){$('#toggle').animate({ height : 'toggle' }); });});
#Layer13copy2 { position: absolute; width: 292px; height: 37px; background-color:blue; } #toggle{ background-color: #3a97b1; top: 35px; position: absolute; width: 100%; height: 100px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <div id="Layer13copy2" > <div id="toggle" marginwidth="0"></div> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.