单击时我移动了两个 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( function () {
//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'});
});