var header = 0, navbar = 0, sticky = 0; $(document).ready(function () { SetLanguage("bg"); setInterval('fn_Roller()', 5000); // Create the observer like the examples above const observer = new IntersectionObserver(entries => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.style.visibility='visible'; entry.target.style.animation = ''; return; } // entry.target.style.visibility='hidden'; // entry.target.style.animation = 'none'; }); }); // Get multiple elements instead of a single one using "querySelectorAll" const squares = document.querySelectorAll('.ucs-animation'); // Loop over the elements and add each one to the observer squares.forEach((element) => observer.observe(element)); //sticky window.onscroll = function() {fn_Sticky()}; header = document.getElementById("header"); navbar = document.getElementById("navbar"); sticky = navbar.offsetTop; $( "#header" ).on("click", ".menu", function(e) { if($(this).hasClass("show")){ $(this).removeClass("show"); $("#nav").removeClass("show"); } else { $(this).addClass("show"); $("#nav").addClass("show"); } }); }); function fn_Sticky() { if (window.pageYOffset >= sticky || window.scrollY >= sticky) { header.classList.add("sticky_padding"); navbar.classList.add("sticky") } else { navbar.classList.remove("sticky"); header.classList.remove("sticky_padding"); } } //language function SetLanguage(lang){ document.documentElement.lang = lang; // set html lang $("*[textLang]").each(function() { // if (typeof $(this).attr("placeholder") !== "undefined" && $(this).attr("placeholder") !== false) $(this).attr("placeholder", LANGS[lang][$(this).attr("textLang")]); if (typeof LANGS[lang][$(this).attr("textLang") + "-text"] !== "undefined") $(this).html(LANGS[lang][$(this).attr("textLang") + "-text"]); if (typeof $(this).attr("title") !== "undefined"){ if (typeof LANGS[lang][$(this).attr("textLang") + "-tooltip"] !== "undefined"){ $(this).attr("title", LANGS[lang][$(this).attr("textLang") + "-tooltip"]); } else { $(this).attr("title", LANGS[lang][$(this).attr("textLang") + "-text"]); } } }); } function fn_Roller(){ if($("#main .quote-wrapper").css("visibility") === "visible"){ var h_index = $("#main .quote-wrapper .quotes.showing").index(); var s_index = h_index + 1 == 3 ? 0 : h_index + 1; $("#main .quote-wrapper .quotes").eq(h_index).removeClass("showing"); $("#main .quote-wrapper .quotes").eq(s_index).addClass("showing"); $("#main .roller .next-prev li").eq(h_index).removeClass("active"); $("#main .roller .next-prev li").eq(s_index).addClass("active"); } } var velocity = 0.2; function fn_bgScroll(){ var pos = $(window).scrollTop(); var height = $('.image-splash').height(); var img = $('.image-splash').css("backgroundPosition"); var x = img.split(' '); var x2 = x[1]; var h_pos = x2.indexOf("p"); var imgHeight = x2.substr(0, h_pos); $(".image-splash").css('backgroundPosition', '50% ' + Math.round((imgHeight*1 - pos) * velocity) + 'px'); }; //$(window).bind('scroll', fn_bgScroll);