问题
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