View Full Version : Ext. Prototype Scriptaculous width&height as %

10 Jun 2007, 9:52 PM
I don't know if this is a bug in Prototype/Scriptaculous or the prototype adapter or something else, but if I have an element with a style sheet with height and/or width values as percentages, if I do something like element.shift the start size is wrong.

.loading-mask {
width: 100%;
height: 100%;

When I call Ext.get('loading-mask').shift(...) the loading-mask element is instantly resized to 100px x 100px. I assume it is on the first frame of the animation, but I can't be sure. I've tried to step through the code with Firebug, but it jumps from one place to another, passing variables and creating callbacks, etc. I loose track of all the calls and rewrites.

If I call the animation manually, it performs correctly.

Since a lot of my code is still written for Prototype, I really can't drop it easily just yet. So, I hope this doesn't fall off the radar just because the stand-alone option is going to be available soon.

10 Jun 2007, 9:56 PM
BTW - This is the workaround I've put in place to get the FX working. Assume the element is a DIV with an id of "loadingMask".

var mask = Ext.get('loadingMask');
mask.setStyle({width : mask.getWidth() + 'px'});
mask.setStyle({height : mask.getHeight() + 'px'});