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 lightboxTitle( src ) { newSrc = src; name = ''; $('.strip').each(function(){ if( $(this).attr("href") == newSrc ) { name = $(this).attr("title"); return 0; } }); return name; } function lightboxShow( ) { newSrc = $('.lightmybox-item-current .lightmybox-image img').attr("src"); name = lightboxTitle( newSrc ); if( name != 'undefined' ) { if( !$('#lightdesc').length ) { $('body').append('

'); } else { $('#lightdesc').removeClass('temp-hide'); } $('#lightdesc').show(); $('#lightdesc .text').html( name ); } } $(function () { // Lightbox widget $(".strip").lightmybox({ callbacks: { afterShow: function(e) { lightboxShow(); }, afterClose: function() { $('#lightdesc').remove(); }, beforeNext: function() { $('#lightdesc').addClass('temp-hide'); }, beforePrevious: function() { $('#lightdesc').addClass('temp-hide'); }, afterNext: function() { lightboxShow(); }, afterPrevious: function() { lightboxShow(); } } }); $('.tabs > ul li a').click(function(e){ e.preventDefault(); $('.tabs > ul li a').removeClass("active"); $(this).addClass("active"); _trg = $(this).attr("href"); $(".tab").removeClass("active"); $(_trg).addClass("active"); }); $(".acc-title").click(function(e){ $(this).parent().toggleClass("active"); }); $('#contactFormSend').one('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: 3500, smartSpeed: 1500, drag: false, mouseDrag: false, animateIn: "slideInLeft", animateOut: "fadeOut", loop: true, nav: false, dots: true, navText: ['',''] }).addClass("owl-carousel"); var carouselGal = $('.carousel-gallery').owlCarousel({ items: 3, responsive: { 0: { items: 2 }, 800: { items: 3 }, 1200: { items: 4 } }, autoplayHoverPause: false, autoplay: true, autoplayTimeout: 3500, animateIn: "fadeIn", animateOut: "fadeOut", drag: false, mouseDrag: false, loop: true, nav: true, 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();