1. CYBER MONDAY SALE All Access Pass @ $59 / Lifetime & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Using JavaScript, how would I pause a Divi Slider?

Discussion in 'Free Divi Community Forum' started by Brett Davis, Nov 14, 2025.

  1. Brett Davis

    Brett Davis New Member

    On my website, I have a slider that is showing images. Due to ADA compliance, I need to be able to pause this slider. I'm trying to figure out how to do that via JS.

    I had something like this:

    <script>
    jQuery(document).ready(function() {
    $('#btnPause').on('click', function() {
    // Retrieve the text of the button dynamically inside the click event
    var btnText = $(this).attr('aria-label'); // Use $(this) to reference the clicked element

    if (btnText === 'Stop automatic slide show') {
    $('#Logos').addClass('pause');
    $(this).addClass('play');
    $(this).attr('aria-label', 'Play automatic slide show');
    } else {
    $('#Logos').removeClass('pause');
    $(this).removeClass('play');
    $(this).addClass('pause');
    $(this).attr('aria-label', 'Stop automatic slide show');
    }
    });
    });
    </script>

    Unfortunately, this isn't working for me.

    Is adding a pause class to the div of the slider the right approach or am I wrong?

    Could someone point me in the right direction?
     
    1. PRO MEMBER PERKS Divi Ultimate Header Plugin - Add more varieties for your Divi header (12 premade styles) + menu hover effects:Learn More