All Collections
Divi Documentation
Customizing Divi
Stop background video on last frame
Stop background video on last frame
Andrei N avatar
Written by Andrei N
Updated over a week ago

First, add a CSS class to the section or module where you added the background video. Open Advanced settings and add a custom CSS class, e.g. stop_bg_video

Next, place this script to Divi > Theme Options > Integrations > Head:

<script>
(function($) {
    $(document).ready(function() {
        $('.stop_bg_video video').each(function() {
            $(this).removeAttr('loop');
            $(this).mediaelementplayer({
                autoRewind: false
            });
        });
setTimeout(function(){
$(window).trigger('resize');
},500);
    });
})(jQuery);
</script>

That's it! 

You can add the same CSS class stop_bg_video to other sections on other pages and the script will work for all of them.

Did this answer your question?