var wtarget = window.location.hash; // delete hash so the page won't scroll to it window.location.hash = ""; 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)); } startSections = ['','#uslugi','#personel','#ogiery-2','#aktualnosci']; currSect = 1; totSect = 5; $(document).keyup(function(e) { if (e.keyCode == 27) { $('.personel-modal, .personel-tab.on').removeClass("on"); $('personel-modal a.close').unbind("click"); $('.uslugi-modal, .uslugi-tab.on').removeClass("on"); $('uslugi-modal a.close').unbind("click"); $('body').removeClass("blocked"); } }); $(function () { $('.next-scroll').click(function(e){ e.preventDefault(); if ($(this).hasClass("turned") ) { currSect = 0; $('body,html').stop().animate({ scrollTop: 0 },1000); $(this).removeClass("turned"); } else { //$('header a[href="#uslugi"]').click(); $('header a[href="' + startSections[currSect] + '"').click(); currSect++; if(currSect == totSect) { $(this).addClass("turned"); } } }); $('html, body').animate({scrollTop:0}); if( wtarget != '' ) { var ob = $( wtarget ); var offset = ob.offset().top - $('header').outerHeight() + 25; $('body, html').stop().animate({ scrollTop: offset }, 1000); } $('a[href*="#"]:not(.close)').click(function(e) { var url = top.location.href.split("#"); //if( !$(this).hasClass("close") ) { console.log("K"); e.preventDefault(); console.log( url[0] ); if( url[0] == __URL__) { var ob = $( $(this).attr("href") ); var offset = ob.offset().top - $('header').outerHeight() + 25; console.log(offset); $('body, html').stop().animate({ scrollTop: offset }, 1000); } else { // Redir to home page top.location.href = __URL__ + $(this).attr('href'); } //} }); $('.peoples-list .item').click(function(e){ e.preventDefault(); $('body').addClass("blocked"); $('.personel-' + $(this).data("id")).addClass("on"); $('.personel-modal').addClass("on"); $('.personel-modal a.close').click(function(ev){ ev.preventDefault(); $('.personel-modal, .personel-tab.on').removeClass("on"); $('personel-modal a.close').unbind("click"); $('body').removeClass("blocked"); }); }); $('.service-list .item, .uslugi-item').click(function(e){ if( $(this).attr("href") == "javascript:void(0);" ) { e.preventDefault(); //alert("klik " + $(this).data("id")); $('body').addClass("blocked"); $('.uslugi-tab').removeClass("on"); $('.uslugi-' + $(this).data("id")).addClass("on"); $('.uslugi-modal').addClass("on"); $('.uslugi-modal a.close').click(function(ev){ ev.preventDefault(); $('.uslugi-modal, .uslugi-tab.on').removeClass("on"); $('uslugi-modal a.close').unbind("click"); $('body').removeClass("blocked"); }); } }); $('.gallery').Chocolat({ imageSize : 'contain', fullScreen: false, imageSelector: '.fancybox', loop: true }) $('.product-images').Chocolat({ imageSize : 'contain', fullScreen: false, imageSelector: '.choco', loop: true }) $('.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').on('submit', function(evt){ evt.preventDefault(); var k = [ 'name', '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] +'"]'); if ( obj.val().length <= 1 ){ good = false; obj.addClass('error'); } } 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(); } }); $('#modalInForm').on('submit', function(evt){ evt.preventDefault(); good = true; 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(); } }); $('.checkPass').click(function(e){ var pass_ = $('input[name=passDownload]').val(); $.post( __URL__ + 'ajax/responses.php?what=files', { password: pass_ }, function(r){ if ( r != 'error') { $('.logFiles').remove(); $('.text-password').html('
' + r + '
'); } else { alert('NieprawidÅ‚owe hasÅ‚o'); } } ); }); if( $('.start-slider > *').length > 1 ) { var startSlider = $('.start-slider').owlCarousel({ items: 1, autoplayHoverPause: false, autoplay: true, autoplayTimeout: 4000, animateIn: "fadeIn", animateOut: "fadeOut", loop: true, nav: false, dots: true, navText: ['',''] }).addClass("owl-carousel"); $('.slider-nav .nav-right').click(function() { startSlider.trigger('next.owl.carousel'); }) $('.slider-nav .nav-left').click(function() { startSlider.trigger('prev.owl.carousel'); }) } var opinionsCarousel = $('.opinions').owlCarousel({ items: 1, autoplayHoverPause: true, autoplay: true, autoplayTimeout: 3500, animateIn: "fadeIn", animateOut: "fadeOut", loop: true, nav: false, navText: ["‹","›"], dots: true, responsive: { 0: { nav: false, }, 1000: { nav: true } } }).addClass("owl-carousel"); projectStopAnim = false; var projectSlider = $('.project-slider').owlCarousel({ items: 1, autoplayHoverPause: false, autoplay: true, autoplayTimeout: 3500, animateIn: "fadeIn", animateOut: "fadeOut", loop: true, thumbs: true, thumbImage: true, thumbContainerClass: 'owl-thumbs', thumbItemClass: 'owl-thumb-item' }).addClass("owl-carousel"); projectSlider.find("owl-dots").removeClass("disabled"); $('.project-slider').on("click", ".owl-thumbs button", function(e){ if(!projectStopAnim){ console.log("STOP SLIDER"); projectSlider.trigger('stop.owl.autoplay'); projectStopAnim = true; } }); $('.carousel-gallery .carousel').owlCarousel({ responsive: { 0: { items: 1 }, 700: { items: 3, margin: 10 }, 1000: { items: 4, margin:10 }, 1200: { items: 5, margin:20 } }, autoplay: true, autoplayHoverPause: false, autoplayTimeout: 2000, dots: false, loop: true, thumbs: false }).addClass("owl-carousel"); $('.menucall').click(function(e){ e.preventDefault(); if($('header nav').hasClass("on")) { $('body > div').unbind("click"); $('header nav').removeClass("on"); } else { $('header nav').addClass("on"); $('body > div').on("click", function(ev){ $('header nav').removeClass("on"); $(this).unbind("click"); }); if( $(window).width() <= 900 ) { $('header a').click(function(e){ if( $(this).attr("href").indexOf("#") > -1 ) { $('header nav').removeClass("on"); } }); } } }); $('.select .option').click(function(e){ $(this).parent().toggleClass("on"); }); $('.search-project .select ul li').click(function(e){ $(this).parent().parent().removeClass("on"); }); $('.selected-image').click(function(e){ $('.select-images, .mask').toggleClass("on"); $('.mask').click(function(evt){ $(this).removeClass("on"); $('.select-images').removeClass("on"); }); }); $('.select-images .item').click(function(e){ $('.select-images, .mask').removeClass("on"); }); $('.project-tabs:not(.variants-tabs) .nav ul ul a').click(function(e){ e.preventDefault(); var _active = $('.project-tab .tab.active'); var _activeList = $('.project-tabs ul.on'); var _target = $( $(this).attr("href") ); _active.find("img").removeClass("active"); _target.addClass("active"); _active.find("a").removeClass("active"); _activeList.find("a").removeClass("active"); $(this).addClass("active"); }); $('.variants-tabs .nav ul ul a').click(function(e){ e.preventDefault(); $('.variants-tabs ul a').removeClass("active"); var _target = $( $(this).attr("href") ); $('.variant-tab .inner div.active').removeClass("active"); _target.addClass("active"); $(this).addClass("active"); }); function actBox( _this, _isBtn ){ if( _isBtn ) { var _trg = _this.attr("href"); } else { var _trg = _this.find("a").attr("href"); } $('.boxes-content .tab').removeClass('active'); $('.boxes-line .box').removeClass("active"); $(_trg).addClass("active"); if( _isBtn ) { _this.parent().addClass("active"); } else { _this.addClass("active"); } if($(window).width() <= 720){ $('body, html').animate({ scrollTop: $('.boxes-content').offset().top }, 500); } } $('.boxes-line .box a').click(function(e){ e.preventDefault(); actBox( $(this), 1); }); $('.boxes-line .box').click(function(e){ e.preventDefault(); //$(this).find('a[href*="#tab-content"]').click(); actBox( $(this), 0); }); $(window).scroll(function(e){ var _scroll = $(window).scrollTop(); if(_scroll > 100){ $('header').addClass("fixed"); } else { $('header').removeClass("fixed"); } if(_scroll > 150){ $('header').addClass("moved"); } else { $('header').removeClass("moved"); } /*if( $('.gfx-pallets').length > 0 ) { if( isOnScreen('.gfx-pallets') ) { $('.gfx-pallets').addClass("on"); } } */ }); });