Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery切换需要在第一次单击后单击两次_Jquery_Toggle - Fatal编程技术网

Jquery切换需要在第一次单击后单击两次

Jquery切换需要在第一次单击后单击两次,jquery,toggle,Jquery,Toggle,我在单击时移动两个div(打开),当用户单击时,我希望重置其余部分。(在我的小提琴里看起来很清楚) 我第一次运行脚本并单击对象时,它工作得完美无缺,但如果我继续单击,它需要两次单击才能正常工作。我尝试过涉及.click()和e.preventdefault的函数,但都不起作用。我已经在这上面花了很多时间,所以我希望有人能在这方面帮助我 非常感谢 函数(){ },, 函数(){ })) $(“#休闲”)。切换( 函数(){ //$(“#oranje_een”).animate({'left':'

我在单击时移动两个div(打开),当用户单击时,我希望重置其余部分。(在我的小提琴里看起来很清楚)

我第一次运行脚本并单击对象时,它工作得完美无缺,但如果我继续单击,它需要两次单击才能正常工作。我尝试过涉及.click()和e.preventdefault的函数,但都不起作用。我已经在这上面花了很多时间,所以我希望有人能在这方面帮助我

非常感谢

函数(){

},, 函数(){

}))

$(“#休闲”)。切换( 函数(){

//$(“#oranje_een”).animate({'left':'240px'); //$(“#oranje_-twee”).animate({'top':'120px')

},, 函数(){

}))

.toggle()
在最新版本中不推荐使用

此方法签名在jQuery 1.8中被弃用,并在中被删除 jquery1.9。jQuery还提供了一个名为.toggle()的动画方法 用于切换图元的可见性。无论是动画还是 激发事件方法取决于传递的参数集


有关替代方法,请参见
.toggle(fn1,fn2)
函数已弃用。因此我无法再使用它。。。还是怎样
$("#schoenen").toggle(
//schoenen
$("#rood_een").animate({'left':'480px'});
$("#rood_twee").animate({'top':'120px'});

//casual
$("#oranje_een").animate({'left':'240px'});
$("#oranje_twee").animate({'top':'120px'});

//schoenen
//$("#rood_een").animate({'left':'360px'});
//$("#rood_twee").animate({'top':'0px'});

//ceremonie
$("#blauw_een").animate({'left':'120px'});
$("#blauw_twee").animate({'top':'240px'});

//communie
$("#groen_een").animate({'left':'240px'});
$("#groen_twee").animate({'top':'360px'});
$("#rood_een").animate({'left':'360px'});
$("#rood_twee").animate({'top':'0px'});
//casual
$("#oranje_een").animate({'left':'120px'});
$("#oranje_twee").animate({'top':'0px'});

//casual
//schoenen
$("#rood_een").animate({'left':'360px'});
$("#rood_twee").animate({'top':'0px'});

//ceremonie
$("#blauw_een").animate({'left':'120px'});
$("#blauw_twee").animate({'top':'240px'});

//communie
$("#groen_een").animate({'left':'240px'});
$("#groen_twee").animate({'top':'360px'});
$("#oranje_een").animate({'left':'240px'});
$("#oranje_twee").animate({'top':'120px'});