我有…
$("#menu_tl").click(function() { $('.page').fadeOut(); $('.page').animate({ "width": "0px","height": "0px","top": "50px","left": "50px" }); $('#page1').fadeIn(); $('#page1').animate({ "width": "500px","height": "400px","top": "-350px","left": "-450px" },2000); }); $("#menu_tr").click(function() { $('.page').fadeOut(); $('.page').animate({ "width": "0px","left": "50px" }); $('#page2').fadeIn(); $('#page2').animate({ "width": "500px","height": "400px" },2000); });
但是我想说的是,当第二个功能被点击时,所有改变的CSS将被重置。这意味着以下行是错误的:
$('.page').animate({ "width": "0px","left": "50px" });
是错误的,应该被全局重置替换。希望这很清楚
解决方法
这个
$('.page').css({"width":"","height":"","top": "","left" : ""});
应该为你做魔术