• Resolved Terek

    (@terekj)


    Is there a function I can call to reset the slider on a button click?

    Reason for asking is that I am using the slider in a popup however the automatic scroll begins as soon as the page loads and I would like to reset the slider when the popup is opened via a button click.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author simonpedge

    (@simonpedge)

    A solution for this may be in a previous topic – see:
    https://ww.wp.xz.cn/support/topic/need-help-i-want-to-start-slider-when-its-visible-not-on-page-load/

    Do the jQuery code you would use would be:
    <script>

    var owl = jQuery('#SLIDER_ID');
    jQuery('#button').on("click", function(e) {
       owl.trigger('play.owl.autoplay', [1000]);
    });
    </script>

    Where ‘#SLIDER_ID’ is the CSS ID of your Slide Anything slider.
    And ‘#button’ is the CSS ID of a button in your popup.

    Also in your slider settings, set your ‘Slide Duration’ to ‘0’.

    Thread Starter Terek

    (@terekj)

    Many thanks!

    This works excellently and exactly how I wanted it

    My only issue is that it does not work in the popup however that is due to how the popup plugin is coded and not yours, thanks for the quick response

    Plugin Author simonpedge

    (@simonpedge)

    Well investigate using another event, and not button click event:
    jQuery('#button').on("click", function(e) {

    For example if your popup plugin changes the class of a wrapper in order to display you could use something like:

    jQuery('#myDiv').on('classChange', function() {
         // do stuff
    });

    there are loads of jQuery events: https://api.jquery.com/category/events/
    (you trigger on hover, focus, mouseover etc)

    • This reply was modified 5 years, 2 months ago by simonpedge.
    Plugin Author simonpedge

    (@simonpedge)

    I’m assuming that this solution worked for you, so I’m marking this topic as closed.

    Plugin Author simonpedge

    (@simonpedge)

    Closed

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Reset slider’ is closed to new replies.