var section ; var factor = 0.8; var fontSizeStep = 3; function getFontSize(el) { var fs = $(el).css('font-size'); if(!el.originalFontSize)el.originalFontSize =fs; //set dynamic property for later reset return parseFloat(fs); } function setFontSize(fact){ if(section==null) section = $('body').find('*') .filter( function(){return $(this).clone() .children() .remove() .end() .text().trim().length > 0; }); //filter -> exclude all elements without text section.each(function(){ var newsize = fact ? getFontSize(this) * fact : this.originalFontSize; if(newsize) $(this).css('font-size', newsize ); }); } function resetFont(){ setFontSize(); } function increaseFont() { fontSizeStep++; if( fontSizeStep > 5 ) { fontSizeStep = 5; } setFontSize(1 / factor); } function decreaseFont(){ fontSizeStep--; if( fontSizeStep < 1 ) { fontSizeStep = 1; } setFontSize(factor); } function recaptchaCallback() { $('.g-recaptcha').addClass('confirmed').removeClass('error'); } function isMobile(width) { if (width == undefined) { width = 719; } if (window.innerWidth <= width) { return true; } else { return false; } } function setAccess( act ) { console.log("Activating " + dt); nc = '?' + Math.random() * 100000; localStorage.setItem("accessSet", act); if( $('.accessCss').length == 0 ) { $('head').append(''); } var path = __URL__ + 'tpl/page/css/access/'; if( act == 'zoomInText' ) { increaseFont(); } else if( act == 'zoomOutText' ) { decreaseFont(); } else if( act == 'grayscale') { $('.accessCss').attr("href", path + 'grayscale.css' + nc); } else if( act == 'contrast') { $('.accessCss').attr("href", path + 'contrast.css' + nc); } else if( act == 'negative') { $('.accessCss').attr("href", path + 'negative.css' + nc); } else if( act == 'reset' ) { resetFont(); $('.accessCss').remove(); } } $(function() { if (localStorage.getItem("accessSet") === null) { localStorage.setItem("accessSet", ""); } $('.access-icon').click(function(E){ E.preventDefault; $('.access-widget').toggleClass("on"); }); $('.access-widget a').click(function(e){ e.preventDefault(); var act = $(this).attr("data-action"); setAccess( act ); }); }); 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 () { $(document).ready(function (){ $('#start .owl-carousel .item a:last-of-type').each(function(){ if( !$(this).hasClass("btn-orange") && !$(this).hasClass("normal") ) { $(this).addClass("btn btn-orange btn-lg"); } }); $('#start .owl-carousel').owlCarousel({ loop: true, margin: 0, nav: false, dots: false, items: 1, autoplay: true, autoplayTimeout: 5000 }); $('#wydzialy .owl-carousel').owlCarousel({ loop: true, margin: 0, nav: true, navText: ['‹','›'], dots: true, items: 2 }); }); $(".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(); } }); var startSlider = $('.start-slider').owlCarousel({ items: 1, autoplayHoverPause: false, autoplay: true, autoplayTimeout: 5000, animateIn: "fadeIn", animateOut: "fadeOut", loop: true, nav: 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'); }) 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"); $('.project-slider').on("click", ".owl-thumbs button", function(e){ if(!projectStopAnim){ console.log("STOP SLIDER"); projectSlider.trigger('stop.owl.autoplay'); projectStopAnim = true; } }); $('.carousel-gallery').owlCarousel({ items: 4, autoplayHoverPause: false, autoplay: true, autoplayTimeout: 3000, dots: true }).addClass("owl-carousel"); /* $('#realizacje .inner-gallery .carousel').owlCarousel({ items: 3, thumbs: false, nav: false, dots: false, autoPlay: true, autoplayTimeout: 5000 }).addClass("owl-carousel"); */ $('.section-news .carousel').owlCarousel({ responsive: { 0: { items: 1 }, 700: { items: 2, margin: 10 }, 1200: { items: 4, margin:20 } }, autoplay: true, autoplayHoverPause: false, autoplayTimeout: 5000, dots: true, loop: true }).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"); }); } }); $('.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); }); $('.carousel-gallery').Chocolat({ imageSize: 'contain', imageSelector: '.chocolat' }); $('.gallery').Chocolat({ imageSize: 'contain', imageSelector: '.fancybox' }); $(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"); } } }); }); $(document).ready(function(){ dt = localStorage.getItem("accessSet"); if( dt != '' ) { setAccess( dt ); } });