Hi,
I written the following script:
function changeWidth(elm,toWidth){
var width = parseInt(elm.style.width);
var change = toWidth-width;
var total=width+Math.round((change/2));
var timer;
elm.style.width=total+'px';
function c() {
changeWidth(elm,toWidth);
}
if(change==-1 ) {
change=0; }
if(change==0 ) {
clearTimeout(timer);
return;
}
timer=setTimeout(c,1);
}
Demo:
Question: Is it possible to stop this script being executed until it has arrived at the destination. I almost need to be able to lock out MouseEvents until the function returns. Currently it breaks if you roll over the links too quickly. Any help would be very appreciated. Really dont want to do this in Flash.
Cheers,
Mike
I written the following script:
function changeWidth(elm,toWidth){
var width = parseInt(elm.style.width);
var change = toWidth-width;
var total=width+Math.round((change/2));
var timer;
elm.style.width=total+'px';
function c() {
changeWidth(elm,toWidth);
}
if(change==-1 ) {
change=0; }
if(change==0 ) {
clearTimeout(timer);
return;
}
timer=setTimeout(c,1);
}
Demo:
Question: Is it possible to stop this script being executed until it has arrived at the destination. I almost need to be able to lock out MouseEvents until the function returns. Currently it breaks if you roll over the links too quickly. Any help would be very appreciated. Really dont want to do this in Flash.
Cheers,
Mike