I am wrapping up a Squarespace website, the only issue is that I am trying to add an MP4 to the header, I was able to find some code, but the problem is the video keeps looping, even though I added loop="false"... Is there anyway to end the looping, and once it is over, to "display:none" via css?
https://marina-toybina.squarespace.com
<script type="text/javascript">
$(window).bind("load", function() {
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
} else {
var banner = $('#pageWrapper img').first();
if (banner.length === 0)
banner = $('.banner-thumbnail-wrapper > #thumbnail > img').first();
if (banner.length === 0)
banner = $('#parallax-images img').first();
if (banner.length === 0)
banner = $('.has-main-image img').first();
if (banner.length === 0)
banner = $('#page-thumb img').first();
var url = "/s/Countdown-Intro_06.mp4";
banner.hide();
$('<video class="bannerVideo" autoplay="" loop="false" preload><source src="' + url + '" type="video/mp4"></video>').insertAfter(banner);
adjustBanner($('.bannerVideo'), banner);
setTimeout(function() {
adjustBanner($('.bannerVideo'), banner);
}, 2000);
$(window, banner).resize(function() {
adjustBanner($('.bannerVideo'), banner);
setTimeout(function() {
adjustBanner($('.bannerVideo'), banner);
}, 200);
});
}
function adjustBanner (video, banner) {
video.css({
height: banner.css('height'),
width: banner.css('width'),
top: banner.css('top'),
left: banner.css('left'),
position: 'relative',
'object-fit': 'inherit'
});
}
});
</script>