gpt4 book ai didi

javascript - jQuery slideToggle 函数的问题

转载 作者:行者123 更新时间:2023-11-28 07:21:02 25 4
gpt4 key购买 nike

请帮我找出这段代码的问题。我正在尝试创建一个简单的 slideToggle 元素!我首先尝试了这个:

$("..").slideToggle(..,..,..)

我当前的代码如下所示:

我的代码:

$(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>

关于javascript - jQuery slideToggle 函数的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32084854/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com