Menu icon Foundation
Reveal animation javascript trigger

Hello!

I have a modal where I want to change between the several similar modals but without the animation, but I want an animation when I first trigger the modal. So I have no animation set on the modal, but can I have animations for when I trigger the modal with javascript?

 

Currently I'm trying

jQuery(id).foundation('open', {animationIn: 'spin-in'});

without any positive results (Well, the modal opens correctly, but the animation is wrong). Am I close? Can I do it at all?

 

Kindly,

Lars Johansson

revealmodaloptionsjavascript

Hello!

I have a modal where I want to change between the several similar modals but without the animation, but I want an animation when I first trigger the modal. So I have no animation set on the modal, but can I have animations for when I trigger the modal with javascript?

 

Currently I'm trying

jQuery(id).foundation('open', {animationIn: 'spin-in'});

without any positive results (Well, the modal opens correctly, but the animation is wrong). Am I close? Can I do it at all?

 

Kindly,

Lars Johansson

This post has been closed. No new replies can be added.

Lars Johansson almost 3 years ago

Managed to solve it. I'll leave my solution here if anyone else finds this thread and are looking for an answer.

 

For the open with animation I use:

jQuery(".moreicon").click(function (event) {
    var id = "#" + jQuery(this).attr('data-take');
    var modal = new Foundation.Reveal(jQuery(id), {animationIn: "slide-in-up"});
    modal.open();
});

Which sets animation for that modal, then I use 

jQuery(".internallink").click(function (event) {
    var id = "#" + jQuery(this).attr('data-take');
    var modal = new Foundation.Reveal(jQuery(id), {animationIn: ""});
    modal.open();
});

for the internal links, which disables the animation for the modal.

 

Yay!