【发布时间】:2013-06-07 05:11:48
【问题描述】:
单击时我移动了两个 div(打开),当用户单击时,我希望其余部分重置。 (在我的小提琴中看起来很清楚)
我第一次运行脚本并单击对象时,它完美无缺,但如果我继续单击,则需要单击两次才能正常工作。我尝试过涉及 .click() 和 e.preventdefault 的函数,但都没有奏效。我已经花了很多时间在这方面,所以我希望有人可以帮助我。
提前非常感谢!
$("#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").toggle( 函数 () {
//casual
$("#oranje_een").animate({'left':'120px'});
$("#oranje_twee").animate({'top':'0px'});
//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'});
}, 函数 () {
$("#oranje_een").animate({'left':'240px'});
$("#oranje_twee").animate({'top':'120px'});
});
【问题讨论】:
-
.toggle(fn1, fn2)函数已弃用。