$(function() { //SVG Fallback if(!Modernizr.svg) { $("img[src*='svg']").attr("src", function() { return $(this).attr("src").replace(".svg", ".png"); }); }; /* BUTTONS */ $(".btn-pulse").on("click", function(){ var $this = $(this); $this.removeClass("circle-pulse"); setTimeout(function(){ $this.addClass("circle-pulse") }, 1); $this.closest("li").siblings("li").find(".btn-pulse").removeClass("circle-pulse"); }); $(".nav-arrow").on("click", function(){ var $this = $(this); $this.removeClass("arrow-pusle"); setTimeout(function(){ $this.addClass("arrow-pusle"); }, 1); if( $this.hasClass("nav-prev") ) { $this.css("background-position", "0px -30px"); }else if( $this.hasClass("nav-next") ){ $this.css("background-position", "0px 0px"); } setTimeout(function(){ if( $this.hasClass("nav-prev") ) { $this.css("background-position", "0px -45px"); }else if( $this.hasClass("nav-next") ){ $this.css("background-position", "0px -15px"); } }, 300); }); $(".contacts-wrap").liteAccordion({ containerWidth : 367, containerHeight : 30, firstSlide : 2, theme : "", onTriggerSlide : function(){ var $this = $(this), accordItem = $this.parent().siblings("li").children(".contact-text"); if( $this.is(":visible") ){ if( !$this.siblings("h2").hasClass("selected") ){ $this.stop(false, true).fadeOut(0); } if( accordItem.is(":hidden") && !$this.closest("li").hasClass("firts-accord") ){ $this.stop(false, true).fadeOut(0); } }else{ accordItem.stop(false, true).fadeOut(0); } }, onSlideAnimComplete: function(){ var $this = $(this), accordItem = $this.parent().siblings("li").children(".contact-text"); if( $this.is(":hidden") ){ $this.stop(false, true).fadeIn(300); } } }).find(".contact-text:first").hide(0); /* BUTTONS END */ /* CAROUSEL */ var owl = $(".carousel"), pagin = $(".carousel-pagination"), navDots = $(".nav-dots").find(".owl-dot"); owl.owlCarousel({ loop: true, items: 1, mouseDrag: false, touchDrag: false, pullDrag: false, animateOut: 'fadeOut', animateIn: 'fadeIn', nav: false, dotsContainer: ".nav-dots", onInitialized : function(event) { pagin.children(".current-slide").html( "1" ); pagin.find(".all-slides").html( event.item.count ); navDots.filter(":first").children("span").addClass("selected"); } }); owl.on("translate.owl.carousel", function(event) { setTimeout(function() { pagin.find(".current-slide").html( event.page.index + 1 ); }, 450); pagin.find(".current-slide") .stop(true, false) .animate({top: 35, opacity: 0}, 300) .delay(150) .animate({top: 0, opacity: 1}, 0); navDots.children("span").hide("slow", function(){ $(this).removeClass("selected"); }); for(var i = 0; i < navDots.length; i++){ if( i == event.page.index ){ $(navDots[i]).children("span").show( 500 , function(){ $(this).addClass("selected"); }); } } }); // CAROUSEL NAV var carouselSwitch = true; function skipEvents( trigger, delay ){ if( carouselSwitch ){ carouselSwitch = false; owl.trigger( trigger ); setTimeout(function(){ carouselSwitch = true; }, delay ); } } $(".nav-next").click(function() { skipEvents( "next.owl", 500 ); }); $(".nav-prev").click(function() { skipEvents( "prev.owl", 500 ); }); owl.on("mousewheel", ".owl-stage", function (e){ if(e.deltaY>0){ skipEvents( "prev.owl", 600 ); }else{ skipEvents( "next.owl", 600 ); } e.preventDefault(); }); // CAROUSEL DOTS $(".owl-dot").click(function () { owl.trigger("to.owl.carousel", [$(this).index()]); }); /* CAROUSEL END*/ /* RESPONSIVE */ $(".mnu").on("click", function(){ $(this).stop(false, true).toggleClass("opened"); $(".mobile-mnu-list").stop(false, true).slideToggle(600); }); $(".nav-mobile").find("a").on("click", function(){ $(".mobile-mnu-list").stop(false, true).slideUp(600); $(".mnu").removeClass("opened"); }); $(".nav-mobile").children("li").children("a").hover(function(){ $(this).parent("li").addClass("hover"); },function(){ $(this).parent("li").removeClass("hover"); }); function changePlaceholder(){ if( ( $(window).width() <= "1500" ) && ( $(window).width() >= "992" ) ){ $(".form").find(".email").attr("placeholder", "Подписка на новости"); placehdr = "Подписка на новости"; }else { $(".form").find(".email").attr("placeholder", "Введите e-mail для подписки на новости"); placehdr = "Введите e-mail для подписки на новости"; } } function changeLogo(){ var logoImage = $(".logo-footer").find("img"); if( ( $(window).width() <= "992" ) ){ logoImage.attr("src", "img/bogdanov-logo.png"); }else{ logoImage.attr("src", "img/logo-footer.png") } } changePlaceholder(); changeLogo(); $(window).on("resize", function(){ changePlaceholder(); changeLogo(); }); /* FORM */ var placehdr = $(".form").find(".email").attr("placeholder"); $(".form").find(".email").on("focus", function(){ $(this).attr("placeholder", ""); $("#footer .form button").animate({right: 0}, 250); }).on("blur", function(){ $(this).attr("placeholder", placehdr); $("#footer .form button").animate({right: -7}, 250); }).on("keypress", function(e){ if (e.which == 13) { event.preventDefault(); $(".form").submit(); // return false; } }); $(".preloader").fadeOut(300); });