javascript - 使用 Jquery 调用 Javascript 函数

标签 javascript jquery

我在 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/

相关文章:

javascript - jQuery 获取此表单输入

javascript - 忽略重音字符的 string.search()?

jquery - 如何清除 select2 下拉列表?

javascript - 鼠标移动交叉时的悬停延迟

javascript - 使用 JavaScript 自动登录

javascript - 我刚刚添加了 var React = require ('react-native' );我的整个构建失败了

javascript - 带分页的 AWS s3 listobjects

javascript - 如何从jquery中的文本区域获取选定的文本?

javascript - 如何从类中排除 getter 以创建存储库?

javascript - 将 Html 作为参数从 javascript 发送到 asp.net mvc Controller