on my Magento2.4 I have an issue where owl-carousel will randomly not load.
Here is my default_head_blocks.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" src="https://fonts.googleapis.com/css?family=Roboto+Slab%3A400%2C700%7CCinzel%3A400%2C700%7COswald%3A400%2C500%2C600%2C700&subset=latin%2Clatin-ext&ver=5.5" src_type="url" />
<font src="fonts/Luma-Icons.woff2"/>
<css src="css/bootstrap.min.css"/>
<css src="css/owl.carousel.min.css"/>
<css src="css/custom.css" media="all"/>
<link src="js/custom.js"/>
<!-- MailMunch.com code -->
<script src="//a.mailmunch.co/app/v1/site.js" id="mailmunch-script" data-mailmunch-site-id="431303" async="async" src_type="url"></script>
</head>
and here is my custom.js file
require(['jquery','js/owlcarousel.min'],
function($){
$(document).ready(function() {
$('.owl-carousel').owlCarousel({
loop:true,
nav:false,
items:1,
dots:true,
autoplay:true,
autoplayTimeout:3000
})
$(".homepagevid").hide();
$('.homepagevidclick').click(function ()
{
$('.homepagevid').show();
$('.homepagevid').attr('src', 'https://player.vimeo.com/video/379262940?autoplay=1');
$('.homepagevidclick').hide();
$('.fa.fa-play-circle').hide();
});
$('.cms-home .fa.fa-play-circle').click(function ()
{
$('.homepagevid').show();
$('.homepagevid').attr('src', 'https://player.vimeo.com/video/379262940?autoplay=1');
$('.homepagevidclick').hide();
$('.fa.fa-play-circle').hide();
});
$(".action.subscribe.primary").click( function() {
$(window).scrollTop(0);
});
$(".messages").fadeOut("slow");
function startAnimations() {
$("#toplefttxtscroller li").hide();
function loop() {
var $li = $("#toplefttxtscroller li:first-child").fadeIn(3000, function () {
$li.fadeOut(400, function () {
$li.appendTo('#toplefttxtscroller');
loop()
})
});
}
loop()
}
startAnimations();
});
});