var $ = jQuery.noConflict(); $(document).ready(function() { // Redirect /catalog/ default page on sign-in to new site if ($('#page').find('.catalog-area').length > 0 ) { window.location.replace("https://fit.brainingcenter.com/our-programs/"); } if ($('#page').find('.hero_banner').length > 0 && $('#page').find('.trending-categories.trending_categories').length > 0) { window.location.replace("https://fit.brainingcenter.com/"); // alert('test'); } // Gets the video src from the data-src on each button var $videoSrc; $(".video-btn").click(function() { $videoSrc = $(this).attr("data-src"); console.log("button clicked" + $videoSrc); }); // when the modal is opened autoplay it $("#myModal").on("shown.bs.modal", function(e) { console.log("modal opened" + $videoSrc); // set the video src to autoplay and not to show related video. Youtube related video is like a box of chocolates... you never know what you're gonna get $("#video").attr( "src", $videoSrc + "?amp;showinfo=0&modestbranding=1&autoplay=1" ); }); // stop playing the youtube video when I close the modal $("#myModal").on("hide.bs.modal", function(e) { // a poor man's stop video $("#video").attr("src", $videoSrc); }); // document ready }); /*fixed menu on scroll for desktop*/ if ($(window).width() > 992) { $(window).scroll(function(){ if ($(this).scrollTop() > 40) { $('#navbar_top').addClass("fixed-top"); // add padding top to show content behind navbar $('body').css('padding-top', $('.navbar').outerHeight() + 'px'); }else{ $('#navbar_top').removeClass("fixed-top"); // remove padding top from body $('body').css('padding-top', '0'); } }); } // end if