我在 Javascript 中有两个函数:
function getWindowWidth(){
var x = 0;
if (self.innerHeight){
x = self.innerWidth;
}else if (document.documentElement && document.documentElement.clientHeight){
x = document.documentElement.clientWidth;
}else if (document.body){
x = document.body.clientWidth;
}return x;
}function getWindowHeight(){
var y = 0;
if (self.innerHeight){
y = self.innerHeight;
}else if (document.documentElement && document.documentElement.clientHeight){
y = document.documentElement.clientHeight;
}else if (document.body){
y = document.body.clientHeight;
}
这些似乎是根据窗口的大小设置文档窗口的高度和宽度?我可能在这里错了......
我所做的是在该文档上方嵌入一个工具栏,该工具栏可以在不同的位置隐藏或显示。
当我使用下面的 jQuery 时,我需要调用上面的函数,
$("#Main").animate({top: "89px"}, 200);
非常感谢任何帮助!
最佳答案
animate()
接受回调函数。
$("#Main").animate({top: "89px"}, 200, function() {
getWindowWidth();
getWindowHeight(); });
关于javascript - 使用 Jquery 调用 Javascript 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2990279/