(function ($) { var isMobile = false; $(document).ready(function () { $(window).resize(sizeAdjust); $("#hamburger").on("click", toggleMenu); $(window).on("click", clickOutSide); $(window).on("scroll", scrollNavbar); scrollNavbar(); sizeAdjust(); // on click comparison if ($("#comparison_title").length) { $("#comparison").removeAttr("href"); $("#comparison").on("click", function (e) { e.preventDefault(); $("html,body").animate({ scrollTop: $("#comparison_title").offset().top - 70 + "px" }, 1000, "swing" ); }); } $('[data-toggle="popover"]').popover({ trigger: "hover" }); setTimeout(function(){ //popup(); }, 2000); myTimer() }); function scrollNavbar() { if ($(this).scrollTop() > 0) $("#navbar-main").addClass("navbar-move"); else $("#navbar-main").removeClass("navbar-move"); } function clickOutSide(e) { if ($("#hamburger").hasClass("active") && !$(e.target).is("#menu_open") && !$(e.target).is("#hamburger") && !$(e.target).is("#hamburger>hr")) closeMenu(); } function closeMenu() { $("#hamburger").removeClass("active"); $("#menu_open").removeClass("open_menu"); $("body").removeClass("no_scroll"); $("#menu_overlay").removeClass("active"); } function toggleMenu() { $("#hamburger").toggleClass("active"); $("#menu_open").toggleClass("open_menu"); $("body").toggleClass("no_scroll"); $("#menu_overlay").toggleClass("active"); } function sizeAdjust() { closeMenu(); if (window.innerWidth > 768 && isMobile) { isMobile = false; scrollNavbar(); $(window).on("scroll", scrollNavbar); } else if (window.innerWidth <= 768 && !isMobile) { isMobile = true; $(window).off("scroll", scrollNavbar); $("#navbar-main").addClass("navbar-move"); } } var isTableMobile = false; var speed = 400; $(document).ready(function () { $(".answers_questions li.question").on("click", function () { $(this) .next() .slideToggle(speed) .siblings(".answers_questions li.answer") .slideUp(speed); }); // ------------- guide carusel ------------- $(".guide_carusel .glyphicon:nth-of-type(2)").on("click", function () { $(".read_about:nth-of-type(1)").appendTo(".guide_caruse_content"); }); $(".guide_carusel .glyphicon:nth-of-type(1)").on("click", function () { $(".read_about:nth-last-of-type(1)").prependTo(".guide_caruse_content"); }); // ------------- faq carusel ------------- $("#right").on("click", function () { $(".questions .question:nth-of-type(1)").appendTo(".questions"); }); $("#left").on("click", function () { $(".questions .question:nth-last-of-type(1)").prependTo(".questions"); }); // ------------- table ------------- tableTitle(); // ------------- FAQ ------------- autoHight(); $(window).resize(function () { autoHight(); tableTitle(); }); }); function tableTitle() { if (window.innerWidth > 768 && isTableMobile) { isTableMobile = false; $(window).off("scroll", scrollTableTitle); if ($(".title_table").css("display") != "none") $(".title_table").css("display", "none"); } else if (window.innerWidth <= 768 && !isTableMobile) { isTableMobile = true; $(window).on("scroll", scrollTableTitle); } } function scrollTableTitle() { if($(".table_comparison").length>0) { if ($(".table_comparison").offset().top + 100 <= $(window).scrollTop()) $(".title_table").addClass("active"); else $(".title_table").removeClass("active"); } } function autoHight() { var max = 0; $(".questions").height("auto"); $(".questions .question").height("auto"); $(".questions .question").each(function () { var elementHeight = $(this).height(); if (max < elementHeight) max = elementHeight; }); $(".questions .question").height(max + 60 + "px"); $(".questions").height(max + 140 + "px"); } $(".progress").each(function() { var value = $(this).attr('data-value'); var left = $(this).find('.progress-left .progress-bar'); var right = $(this).find('.progress-right .progress-bar'); if (value > 0) { if (value <= 50) { right.css('transform', 'rotate(' + percentageToDegrees(value) + 'deg)') } else { right.css('transform', 'rotate(180deg)') left.css('transform', 'rotate(' + percentageToDegrees(value - 50) + 'deg)') } } }) function percentageToDegrees(percentage) { return percentage / 100 * 360 } })(jQuery); var pop_up_once=true function pop_up_prevent() { if(pop_up_once) { event.preventDefault() popup(); pop_up_once=false } } var sec=1000 function myTimer() { // Update the count down every 1 second var x = setInterval(function() { // Get today's date and time // Find the distance between now and the count down date var distance = 3600000*8-sec sec+=1000 // Time calculations for days, hours, minutes and seconds var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); if(document.getElementById("timer")!==null&&document.getElementById("timer_footer")!==null) { // Display the result in the element with id="demo" if(minutes<10&&seconds<10) { document.getElementById("timer").innerHTML = "0"+hours + " : 0" + minutes + " : 0" + seconds ; document.getElementById("timer_footer").innerHTML= "0"+hours + " : 0" + minutes + " : 0" + seconds ; } else if(minutes<10) { document.getElementById("timer").innerHTML = "0"+hours + " : 0" + minutes + " : " + seconds ; document.getElementById("timer_footer").innerHTML = "0"+hours + " : 0" + minutes + " : " + seconds ; } else if(seconds<10) { document.getElementById("timer").innerHTML = "0"+hours + " : " + minutes + " : 0" + seconds ; document.getElementById("timer_footer").innerHTML = "0"+hours + " : " + minutes + " : 0" + seconds ; } else{ document.getElementById("timer").innerHTML = "0"+hours + " : " + minutes + " : " + seconds ; document.getElementById("timer_footer").innerHTML = "0"+hours + " : " + minutes + " : " + seconds ; } } // If the count down is finished, write some text if (distance < 0) { clearInterval(x); document.getElementById("timer").innerHTML = "EXPIRED"; document.getElementById("timer_footer").innerHTML = "EXPIRED"; } }, 1000); }