gpt4 book ai didi

javascript - JQuery 脚本,适用于 Firefox,不适用于 IE、Chrome

转载 作者:行者123 更新时间:2023-11-28 16:26:41 24 4
gpt4 key购买 nike

我有以下脚本,根据关闭/启用变量的条件,将一个容器向下滑动,另一个向上滑动,反之亦然。

该脚本在 Firefox 中运行良好,但是在 IE 和 Chrome 中,它不起作用:(

谁能给点建议吗?

非常感谢!这是脚本。

(OCH var 获取通过 ajax 加载元素的容器的高度,因此它知道何时再次打开它要打开多少像素 - 这是最好的方法吗?)

            $(document).ready(function()
{
//Grab the height of the container after its loaded with all the calls in...
var och = $('#calls').height();
//Are we allowed to close this panel yet?
var enabled = false;
//is the panel closed or not?
var closed = false;
$(".survey-description").click(function () {
if (enabled == true) {
if (closed == false) {
$(this).closest("#calls").stop().animate({"height": "44px"}, "fast");
closed = true;
}
else {
$(this).closest("#calls").stop().animate({"height": och}, "medium");
closed = false;
}
}
});

$(".linktoCall").click(function () {
if (closed == false) {
//Now we can toggle the top panel...
enabled = true;
$(this).closest("#calls").stop().animate({"height": "44px"}, "fast");
closed = true;
}
});

});

编辑这里是渲染元素的一些 html。

<div id="survey-description"></div>
<div id="calls">
<div>
<p onclick="showCall('tgkn5xabgnivkaf');" id="notstarted" class="linktoCall">59677 tgkn5xabgnivkaf<br>NOT STARTED - SAVED</p>
</div>
</div>

<div id="aCall">
</div>

最佳答案

看看 HTML 片段,我猜它应该是

<div class="survey-description"></div>

因为选择器$('.survey-description')引用的是一个类,而不是一个id。

关于javascript - JQuery 脚本,适用于 Firefox,不适用于 IE、Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7791095/

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