我使用.animate函数创建了自己的jQuery滑块,当我使用它时,滑块工作一次,两次,但是在第3次尝试时,它会发疯!基本上它类似于微软的“For Home”和“For Work”滑块,但复杂程度要低得多(现在)
它存在于网站上,为了告诉你我的意思,这里是网址: http://glorbi.com/index3
(点击For Work,然后单击For Home,然后单击For work,它开始失败)
这是处理滑动的jQuery:
$("#sidebar2").click(function(){
$("#innerSec2").animate({"right" : 130}, 1000);
$("#sidebar2").animate({"height" : 1100});
$("#innerSec").animate({"left" : -840}, 1000);
$("#innerSec").animate({"left" : 840}, 200);
$("#sidebar").animate({"height" : 400});
});
$("#sidebar").click(function(){
$("#innerSec").animate({"left" : 0}, 1000);
$("#sidebar").animate({"height" : 1100});
$("#innerSec2").animate({"right" : 970}, 1000);
$("#innerSec2").animate({"left" : 710}, 200);
$("#sidebar2").animate({"height" : 400});
});
我尝试过使用回调,但它们会导致更顺序的反应,将滑块移动到部分区域,看起来非常糟糕。
此外,我知道z-index问题,因为它会滑动,我会修复它!
有谁知道如何解决这个问题?代码非常通用,并且它对每个动作都是严格的值,我真的不知道它是如何失败的。 :S
非常感谢!任何帮助是极大的赞赏! :)
答案 0 :(得分:0)
在萤火虫中摆弄它之后,我发现left:710px
上的innerSec2
导致问题,在我们点击sidebar2
div之后,所以我尝试了以下它似乎工作除了z order
您可以解决的问题:D
$("#sidebar2").click(function(){$("#innerSec2").animate({"left":-130},0);});