• so halfway down the links to JS API Overview and Code Generator return a 404 error. i did leave a message with the customer support sales side of things on divimode.com.

    what I need help with is adding some code to a snippet i have that autoruns a video in a popup when the popup is triggered and it auto closes the popup when the video ends. however I have a couple of pages that also have a divi section background video. and im seeing some performance glitches. so i am aiming to add some code that pauses the background video when the popup is triggered.

    I did find this snippet that pauses a background video on mouse hover so i think i am on the right track.

    <script>
    window.onload = function() {
    let videoBg = document.getElementsByClassName('mejs-mediaelement')[0].firstElementChild.firstElementChild;
    let bg = document.getElementsByClassName('et_pb_section_video')[0];
    videoBg.pause();
    bg.addEventListener('mouseover', function() {
    videoBg.play();
    });
    
    bg.addEventListener('mouseleave', function() {
    videoBg.pause();
    });
    }
    </script>

    so this tests out good on my pages.

    here is my code snippet

    <script>
    
    jQuery(document).ready(function ($) {
    homeVideoElement1 = $("#divi-video-container1 video")[0];
    homeVideoElement2 = $("#divi-video-container2 video")[0];
    DiviArea.addAction('show_area', function(area) {
    if (area.hasId('sim-intro')) {
    homeVideoElement1.play();
    }
    if (area.hasId('libraryintro')) {
    homeVideoElement2.play();
    }
    // console.log('im open');
    });
    
    $('video').on('ended',function(){
    //console.log('Video has ended!');
    $('a.da-close').trigger('click');
    });
    });
    
    </script>

    could someone help me with some code to add to my snippet to pause the background video?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hi @ecousins25,

    Did your issue get resolved? If you still require assistance, please let me know; I will be happy to provide you with any additional help you may need.

    Thank you for your patience and understanding.

Viewing 1 replies (of 1 total)
  • The topic ‘where is the API support documentation? need help adding code to a code snippet’ is closed to new replies.