CLiown
CLiown

Reputation: 13843

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!

Upvotes: 0

Views: 180

Answers (1)

Sean Vieira
Sean Vieira

Reputation: 159905

animate() takes a callback function.

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

Upvotes: 2

Related Questions