简体   繁体   中英

Call a Javascript Function with Jquery

I have two functions in 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;
}

These appear to set the height and width of the document window, based on the size of the window? I could be wrong here....

What I have done is embeded a toolbar above this document, this toolbar can be hidden or shown at various points.

I need the above function to be called when I use the following jQuery,

$("#Main").animate({top: "89px"}, 200);

Any assistance greatly appreciated!

animate() takes a callback function.

$("#Main").animate({top: "89px"}, 200, function() {
    getWindowWidth(); 
    getWindowHeight(); });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM