Trigger layer event with JavaScript

⚠️ This article was created for developers!

To be able to follow the steps, you're required to have coding knowledge. If you're not a developer and can't achieve what you're looking for, consider hiring a developer.

Make sure to carefully follow the tutorial and write correct code. We're unable to provide help with custom coding, or the possible issues that are happening because of them.

You can trigger a custom event with JavaScript code like this:

n2ss.trigger(jQuery('.n2-ss-slide-active'), 'eventname');

For example, trigger the "switch" event on slide switching at slider #47:

n2ss.ready(47, function(slider, sliderElement) {
    sliderElement.on('mainAnimationComplete', 
    function(e, animation, previousSlideIndex, currentSlideIndex) {
       n2ss.trigger(jQuery('.n2-ss-slide-active'), 'switch');
    });
});
If you need to trigger events on a static slide, use the .n2-ss-static-slide class instead.
n2ss.trigger(jQuery('.n2-ss-static-slide'), 'switch');
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.