Limited availability during the holidays

Another busy year is coming to its end, and an exciting year lies ahead. In order to get ready for a fresh new start, our team will spend a few days' rest during the winter holidays. Over the holiday break, we will have reduced staffing from December 20th, 2024, to January 5th, 2025, so please be patient if you do not receive a response as quickly as you normally would.

We send our warmest wishes for happiness, health, and success throughout the coming year. Thank you for your continued support, and may you have a peaceful and blessed Happy Holidays!

Okay
  Public Ticket #3114076
Layerslider gets stuck
Closed

Comments

  • Diana Burr started the conversation

    Layerslider gets stucks. To duplicate the problem go to https://dickiesarena.wpengine.com/ and start clicking the right arrow (or left arrow). Towards the end of the slides it gets stuck. I did add the below script to stop the autoplay when the navigation arrows are clicked. When I remove the lines "slider.api('stop'), it doesn't get stuck but I need this feature. Do you know why its getting stuck?

      // stopping carousel when navigation is clicked
                $('#featured-event-carousel').on('slideshowStateDidChange', function(event, slider) {
                    $('.ls-nav-prev').click(function() {
                        slider.api('stop');
                        slider.api('pauseMedia');
                    });
                    $('.ls-nav-next').click(function() {
                        slider.api('stop');
                        slider.api('pauseMedia');
                    });
                });

  •  73
    John replied

    Hi Diana,

    The slideshowStateDidChange event repeatedly fires, and you're attaching click events again and again that also change the slideshow state, which in turn calls the whole stack again. You're essentially creating a loop that grows larger and larger each time you click on one of the arrow keys.

    I'd suggest running your code in the sliderDidLoad event, which is called only once for each slider. You can also run your code outside of LayerSlider's event handlers by using delegated events, so it doesn't matter when the sliders are loaded.

    Calling pauseMedia shouldn't be necessary since LayerSlider always pauses any active media playback on slide change.

    Best Regards,
    John | Kreatura Dev Team