// ACTIVITY INDICATOR var imageLightBoxItems = { count: 0, byIndex: {}, byHref: {}, }; var activityIndicatorOn = function(){ $('
').appendTo('body'); }, activityIndicatorOff = function(){ $('#imagelightbox-loading').remove(); }, // OVERLAY overlayOn = function(){ $('
').appendTo('body'); }, overlayOff = function(){ $('#imagelightbox-overlay').remove(); }, // CLOSE BUTTON closeButtonOn = function(instance){ $('').appendTo('body').on('click touchend', function() { $(this).remove(); instance.quitImageLightbox(); return false; }); }, closeButtonOff = function(){ $('#imagelightbox-close').remove(); }, // CAPTION captionOn = function(){ var description = $('a[href="' + $('#imagelightbox').attr('src') + '"] img').attr('alt'); if (description != '' && description != undefined) $('
' + description + '
').appendTo('body'); }, captionOff = function(){ $('#imagelightbox-caption').remove(); }, // NAVIGATION navigationOn = function(instance, selector){ var images = $(selector); if (images.length) { var nav = $('
'); for (var i = 0; i < images.length; i++) nav.append(''); nav.appendTo('body'); nav.on('click touchend', function() { return false; }); var navItems = nav.find('button'); navItems.on('click touchend', function() { var $this = $(this); if (images.eq($this.index()).attr('href') != $('#imagelightbox').attr('src')) instance.switchImageLightbox($this.index()); navItems.removeClass('active'); navItems.eq($this.index()).addClass('active'); return false; }) .on('touchend', function() { return false; }); } }, navigationUpdate = function(selector) { var items = $('#imagelightbox-nav button'); items.removeClass('active'); items.eq($(selector).filter('[href="' + $('#imagelightbox').attr('src') + '"]').index(selector)).addClass('active'); }, navigationOff = function(){ $('#imagelightbox-nav').remove(); }, // ARROWS arrowsOn = function (instance, selector) { var $arrows = $(''); $arrows.appendTo('body'); $arrows.on('click touchend', function (e) { var $this = $(this); var index = imageLightBoxItems.byHref[$('#imagelightbox').attr('src')]; e.preventDefault(); if (typeof index === 'undefined') { return false; } if ($this.hasClass('imagelightbox-arrow-left')) { index = index - 1; if (typeof imageLightBoxItems.byIndex[index] === 'undefined') { index = imageLightBoxItems.count - 1; } } else { index = index + 1; if (typeof imageLightBoxItems.byIndex[index] === 'undefined') { index = 0; } } instance.switchImageLightbox(index); return false; }); }, arrowsOff = function() { $('.imagelightbox-arrow').remove(); }; var imageLighBoxSelector = 'a.fancybox', imageLightboxInstance = $(imageLighBoxSelector).imageLightbox({ onStart: function() { overlayOn(); closeButtonOn( imageLightboxInstance ); arrowsOn( imageLightboxInstance, imageLighBoxSelector ); }, onEnd: function() { overlayOff(); captionOff(); closeButtonOff(); arrowsOff(); activityIndicatorOff(); }, onLoadStart: function() { captionOff(); activityIndicatorOn(); }, onLoadEnd: function() { captionOn(); activityIndicatorOff(); $( '.imagelightbox-arrow' ).css( 'display', 'block' ); } }); $(imageLighBoxSelector).each(function (index) { imageLightBoxItems.byHref[$(this).attr('href')] = index; imageLightBoxItems.byIndex[index] = $(this).attr('href'); imageLightBoxItems.count += 1; }); $(document).ready(function(){ $('#menucall').click(function(e){ e.preventDefault(); $('.mobilemenu').toggleClass("on"); }); $('#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; } if ( $(this).find('[name="phone"]').val().replace(/[^\d]/, '').length < 9 ){ $(this).find('[name="phone"]').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(); } }); $('#my-form-horizontal').on('submit', function(evt){ evt.preventDefault(); var k = [ 'code-postal', 'city', 'name', 'lastname', 'message' ], good = true; $(this).find('[name]').removeClass('error'); $(this).find('p.ajaxInfo').hide(); if($(this).find('#usluga-1').prop('checked') == false && $(this).find('#usluga-2').prop('checked') == false && $(this).find('#usluga-3').prop('checked') == false && $(this).find('#usluga-4').prop('checked') == false && $(this).find('#usluga-5').prop('checked') == false && $(this).find('#usluga-6').prop('checked') == false && $(this).find('#usluga-7').prop('checked') == false){ $(this).find('[name="usluga[]"]').addClass('error'); good = false; } 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; } if ( $(this).find('[name="phone"]').val().replace(/[^\d]/, '').length < 9 ){ $(this).find('[name="phone"]').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(); } }); $('#scroll-up').click(function (evt) { //evt.preventDefault(); var target = $('.scrollphone'); if(target.hasClass("on")) { //$('body > div').unbind("click"); target.removeClass("on"); } else { target.addClass("on"); /*$('body > div').on("click", function(ev){ target.removeClass("on"); //$(this).unbind("click"); });*/ } }); // Zabiegaj linkom # $('a[href=#]').click(function(e){ e.preventDefault(); }); }); $(window).load(function(){ $('.shop-category-carousel').owlCarousel({ lazyLoad : true, navigation : true, autoPlay: 3000 }); $('.slider').owlCarousel({ items: 1, nav: true, dots: false, autoplay: true, autoplaySpeed: 4000, loop : true, navContainer: ".text", navText: ['‹', '›'], animateOut: 'fadeOut', touchDrag: false, mouseDrag: false }); }); $(window).scroll(function () { var scrollTop = $(window).scrollTop(); if (scrollTop > 0) { $('#scroll-down').removeClass('show'); $('#scroll-up').addClass('show'); } else { $('#scroll-down').addClass('show'); $('.scrollphone').removeClass('on'); $('#scroll-up').removeClass('show'); } });