How to stop the video in Divi background at the last frame

让人想犯罪 __ 提交于 2019-12-24 14:36:05

问题


I want your help about Divi theme. I set a video background in a fullwidth section. I disabled loop so the video plays only once when the page is loaded. My problem is this: I want the video to stop at the last frame. Now, when the video is completed the image which displays is the first frame. Any suggestions??


回答1:


I ran into the same problem. I figured out that Divi uses MediaPlayer.js which has an option "autoRewind" which you can set to false.

I modified the ElegantThemes recommended loop disable javascript snippet to include it. This worked for me:

<script>
(function($) {
    $(document).ready(function() {
        $('.no-loop').each(function() {
            $(this).find('video').removeAttr('loop');
        });
        $('video').mediaelementplayer({
            autoRewind: false
        });
    });
})(jQuery);
</script>



回答2:


This worked for me:


<script>
(function($) {
    $(document).ready(function() {

            $(this).find('video').removeAttr('loop');

        $('video').mediaelementplayer({
            autoRewind: false
        });
    });
})(jQuery);
</script>



来源:https://stackoverflow.com/questions/51516285/how-to-stop-the-video-in-divi-background-at-the-last-frame

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!