function checkScroll() { var _scroll = $(window).scrollTop(); //var _wheight = $(window).height(); //var _menuheight = _wheight - $('header.header').outerHeight(); var _menuheight = 50; if( $('body.page-start').length == 1 ) { if( _scroll > _menuheight && $(window).width() > 767 ){ $('header.header').addClass("moved"); } else { $('header.header').removeClass("moved"); } } else { } } function isOnScreen(elem) { var $elem = $(elem); var $window = $(window); var docViewTop = $window.scrollTop(); var docViewBottom = docViewTop + $window.height(); var elemTop = $elem.offset().top; var elemBottom = elemTop + $elem.height(); return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); } function recaptchaCallback() { $('.g-recaptcha').addClass('confirmed'); } $(function () { $('.schemat .circles a').click(function(e){ e.preventDefault(); $('.my-tabs a, .schemat .circles a').removeClass("active"); $(this).addClass("active"); $('.my-tabs-content .content').removeClass("active"); var trg = $(this).attr("href"); $( trg ).addClass("active"); // tab $('.my-tabs a').each(function(){ if( $(this).attr("href") == trg ) { $(this).addClass("active"); } }); $('body, html').animate({ scrollTop: $(trg).offset().top - 100 }, 1000); }); $('.my-tabs a').click( function(e) { e.preventDefault(); $('.my-tabs a, .schemat .circles a').removeClass("active"); $(this).addClass("active"); $('.my-tabs-content .content').removeClass("active"); var trg = $(this).attr("href"); // circle $('.schemat .circles a').each(function(){ if( $(this).attr("href") == trg ) { $(this).addClass("active"); } }); $( trg ).addClass("active"); }); $('li.scroll a').click(function( e ){ e.preventDefault(); var href = $(this).attr("href"); href = href.replace( __URL__, "" ); var trg = $( href ).offset().top; $('body, html').animate({ scrollTop: trg }, 1000); }); // Lightbox widget $(".strip").lighterbox({ overlayColor : "white", loop: true }); $('#contactFormSend').on('submit', function(evt){ evt.preventDefault(); var k = [ 'mail','question' ], good = true; $(this).find('[name]').removeClass('error'); $(this).find('p.ajaxInfo').hide(); if ( /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test( $(this).find('[name="mail"]').val() ) == false ){ $(this).find('[name="mail"]').addClass('error'); good = false; } for ( var i = 0; i < k.length; i++ ){ var obj = $(this).find('[name="'+ k[i] +'"]'); console.log(obj.val()); if ( obj.val().length <= 1 ){ good = false; obj.parents('.form__item').addClass('error'); obj.parents('#rodoagree').addClass('error'); } } if ( $('.g-recaptcha').hasClass('confirmed') ) { $('.recaptcha_error').hide(300).addClass('hide'); good = true; } else { $('.g-recaptcha').addClass('error'); $('.recaptcha_error').show(300).removeClass('hide'); good = false; } if ( good ){ $.post( $(this).attr('action'), $(this).serialize(), (function(response){ if (response.indexOf('false') === -1) { $(this).find('input, textarea').val(''); $(this).find('p.ajaxInfo.ok').show(); } else { $(this).find('p.ajaxInfo.error_send').show(); } }).bind(this)); } else { $(this).find('p.ajaxInfo.error').show(); } console.log(good); }); var startSlider = $('.start-slider').owlCarousel({ items: 1, autoplayHoverPause: false, autoplay: true, autoplayTimeout: 5000, smartSpeed: 1000, drag: false, mouseDrag: false, loop: true, nav: false, dots: true, animateIn: "fadeIn", animateOut: "fadeOut", navText: ['',''] }).addClass("owl-carousel"); var carouselGal = $('.carousel-gallery').owlCarousel({ items: 3, responsive: { 0: { items: 1 }, 800: { items: 2 }, 1200: { items: 4 } }, autoplayHoverPause: false, autoplay: true, autoplayTimeout: 3500, animateIn: "fadeIn", animateOut: "fadeOut", drag: false, mouseDrag: false, loop: true, nav: false, dots: true, navText: ['',''] }).addClass("owl-carousel"); var singleCarousel = $('.carousel').owlCarousel({ items: 1, autoplayHoverPause: false, autoplay: true, autoplayTimeout: 3500, drag: false, mouseDrag: false, loop: true, nav: true, dots: true, navText: ['',''] }).addClass("owl-carousel"); $('.slider-nav .nav-right').click(function() { carouselGal.trigger('next.owl.carousel'); }) $('.slider-nav .nav-left').click(function() { carouselGal.trigger('prev.owl.carousel'); }) $('.menu-call').click(function(e){ e.preventDefault(); $('header.header').toggleClass("on"); if($('.menu-float').hasClass("on")) { $('.menu-float').removeClass("on"); } else { $('.menu-float').addClass("on"); } }); $(window).scroll(function(e){ checkScroll(); }); }); // init checkScroll(); $(window).load(function(){ $(".start-slider").addClass("on"); });