This project is read-only.

Example of Image Description remove animation

May 8, 2012 at 11:46 AM

Hi Guys, 

I'm pretty new to the whole jQuery scene, and was wondering if someone would be kind enough to offer an example of how to remove the image description animation?

I can see the code on the documentation but not sure where to place it, or even if it does what I requre.

if (this.current_description) this.current_description.remove();

 Basically, i have my description separate from the image, and want the description of the current image to dissappear when the next image is loading with the new description. At the moment the description lingers while the transition from one image to another occurs. Will the code above help fix this issue, and if so how can i implement it?.

 

Thanks,

Barry 

May 8, 2012 at 1:18 PM

Hi Barry,
This is an example of how you can delete the old description when the transition to the new image starts.

galleries[0].addAnimation('no_desc',
    function(img_container, direction, desc) {    
        if (this.current_description) {
            this.current_description.remove();
            this.current_description = undefined;
        }
        return galleries[0].animations["slide-hori"].apply(this, [img_container, direction, desc]);
    }
);
galleries[0].settings.effect = "no_desc";

If uses the built in "slide-hori" animation, but you could change that to whichever animation you'd like. This does not however remove the animation of the new description, but I'm not sure if you even wanted that? If you don't want the new description to be animated at all, you can change this:

return galleries[0].animations["slide-hori"].apply(this, [img_container, direction, desc]);

to this:

return galleries[0].animations["slide-hori"].apply(this, [img_container, direction]);

That is, don't pass the desc variable to the built in animation.

May 8, 2012 at 2:43 PM

Brillant!!

Thank you andersekdahl, exactly what i was looking for.

Fantastic work on the AD Gallery, offers alot of functionality and easy to integrate!

Thanks, 

Barry

May 8, 2012 at 5:59 PM

Thank you, glad to hear it worked out!