views:

44

answers:

1

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!

+2  A: 

animate() takes a callback function.

$("#Main").animate({top: "89px"}, 200, function() {
    getWindowWidth(); 
    getWindowHeight(); });
Sean Vieira
Which this is correct, it doesn't really address the problem, look at the functions...what are you doing with their return values? Currently this is just wasting CPU cycles at the animation...
Nick Craver