#232 new
Riprock

Effect.BlindDown and Effect.SlideDown get dimensions at the (arguably) wrong time

Reported by Riprock | August 18th, 2009 @ 11:59 AM

Effect.SlideDown and Effect.BlindDown get the dimensions that they will scale the element to as soon as the Effect function is called. This is a problem for me because I add the effect to the end of a queue, and before the effect starts I update the content of the element.

My proposed changes from effects.js 1.8.2:
603d602
< var elementDimensions = element.getDimensions();
608c607

< scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},

scaleMode: {originalHeight: element.getHeight(), originalWidth: element.getWidth()},

692d690
< var elementDimensions = element.getDimensions();
697c695

< scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},

scaleMode: {originalHeight: element.getHeight(), originalWidth: element.getWidth()},

Unless of course there's some performance reason why it's the way it is.

Comments and changes to this ticket

  • Riprock

    Riprock August 18th, 2009 @ 12:02 PM

    Forgot about Markdown, sorry.
    603d602
    < var elementDimensions = element.getDimensions(); 608c607

    < scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},

    > scaleMode: {originalHeight: element.getHeight(), originalWidth: element.getWidth()}, 692d690
    < var elementDimensions = element.getDimensions(); 697c695

    < scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},

    > scaleMode: {originalHeight: element.getHeight(), originalWidth: element.getWidth()},

  • Riprock

    Riprock August 18th, 2009 @ 12:12 PM

    Oh god I'm sorry, haven't used Markdown before. Lets try this:

    603d602
    <   var elementDimensions = element.getDimensions();
    608c607

    < scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},

    
    
    
    > scaleMode: {originalHeight: element.getHeight(), originalWidth: element.getWidth()}, 692d690 < var elementDimensions = element.getDimensions(); 697c695

    < scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},

    
    
    
    > scaleMode: {originalHeight: element.getHeight(), originalWidth: element.getWidth()},

    Is there some sort of preview or disable Markdown option I'm missing?

  • Riprock

    Riprock August 18th, 2009 @ 12:20 PM

    Oh yeah, this is my fix you can put in your code without changing scriptaculous:

    Effect.SlideDown('content',{
        duration:0.5,
        queue:{scope:'content',position:'end'},
        beforeSetup:function(effect) {
            //the height gets set up on the Effect function call, make it use the height before the effect starts
            effect.options.scaleMode.originalHeight=effect.element.getHeight();
        }
    });
    

    I didn't use afterSetup 'cos Effect.SlideDown uses it internally so when you define it it stops Effect.SlideDown from working. I'm not sure if that's intentional or whether I should file another bug for that.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
<br/><b>Source available from github</b>
The Git repository resides at:
<a href="http://github.com/madrobby/scriptaculous">http://github.com/madrobby/scriptaculous</a>
<br/>Check out the current development trunk with:
<code>git clone git://github.com/madrobby/scriptaculous.git</code>
<br/>As <b>script.aculo.us 1.xx is feature-frozen</b>, this development trunk is for <b>bugfixes only</b>.
<br/>New development should happen only for
<b>script.aculo.us 2</b>.
<br/><b>Creating a bug report</b>
When creating a bug report, be sure to include as much relevant information as possible. Post a an example that shows off the problem. Preferably, <b>alter the unit tests</b> and show through either changed or added tests how the expected behavior is not occuring.

People watching this ticket

Pages