// SMOOTH SCROLLING FOR ANCHOR TAGS WITH IDS (JQUERY) $('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); if (target.length) { $('html, body').animate({ scrollTop: ( target.offset().top - 50) }, 1000); return false; } } }); // MAKE HERO VIDEO ACTUALLY STOP PLAYING WHEN CLOSED let videosThatIhaveToStoreInThisVariableBecauseFirefoxWillAutoplayThemOtherwise = {}; $(document).on('beforeClose.fb', function() { let fbInstance = $.fancybox.getInstance(); let elementId = $(fbInstance.$lastFocus.context).attr("data-src"); videosThatIhaveToStoreInThisVariableBecauseFirefoxWillAutoplayThemOtherwise[elementId] = $(elementId).html(); $(elementId).html(""); }); $(document).on('beforeLoad.fb', function() { let fbInstance = $.fancybox.getInstance(); let elementId = $(fbInstance.$lastFocus.context).attr("data-src"); if (videosThatIhaveToStoreInThisVariableBecauseFirefoxWillAutoplayThemOtherwise.hasOwnProperty(elementId)) { console.log(elementId); $(elementId).html(videosThatIhaveToStoreInThisVariableBecauseFirefoxWillAutoplayThemOtherwise[elementId]); } }) // Turn Off Grabbing for Video Lightbox jQuery(".fancybox-uxi_widget_lightbox2-2").fancybox({ touch : false })