看看下面的代码:
$("#menu_choice").click(function () {
$('#content_home').animate({
"left": "-5000px"
}, 1000);
setTimeout("$('#content_home').hide();", 600);
$('#content_creations').show();
var x = $("body").width() / 2;
var y = $("#content_creations").width() / 2;
$('#content_creations').animate({
'left': x - y
}, 1000);
});
我的问题是x正在计算before $('#content_home').hide() is executed。
在隐藏x之后,我可以通过什么方式“强制”计算代码?#content_home当然,我需要setTimeout命令。我想要的原因是find浏览right dimension器窗口有或没有垂直滚动条。