jQuery(document).ready(function() { /*$('nav.navigation a').hover( function() { if( ! $(this).parent('li').hasClass('current-menu-item')) { $(this).stop(true,false).animate( {'backgroundColor':'#1995cf', 'color':'#fff'}, 300, 'easeOutSine' ); } }, function() { if( ! $(this).parent('li').hasClass('current-menu-item')) { $(this).stop(true,false).animate( {'backgroundColor':'#fff', 'color':'#000'}, 300, 'easeOutSine' ); } });*/ // BOXES POSITION $.fn.extend({ hasClasses: function( selector ) { var classNamesRegex = new RegExp("( " + selector.replace(/ +/g,"").replace(/,/g, " | ") + " )"), rclass = /[\n\t\r]/g, i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && classNamesRegex.test((" " + this[i].className + " ").replace(rclass, " "))) { return true; } } return false; } }); /*function getRes() { jQuery("body").append('
'); var screenWidth = jQuery(window).outerWidth(); jQuery(".windowRes").html(""+screenWidth+"px"); jQuery(window).resize(function() { var screenWidth = jQuery(window).outerWidth(); jQuery(".windowRes").html(""+screenWidth+"px"); }); }*/ // getRes(); function boxesSmall() { // if (jQuery(document).width() <= 320) { // alert("A"); jQuery("#boxes div").each(function() { // alert("B"); if ( jQuery(this).hasClasses("box-single-image") ) { // alert("D"); imgHeight = jQuery(this).children("img").outerHeight(); // alert(imgHeight); // jQuery(this).css("height","0"); // jQuery(this).css("height",""+imgHeight+"px"); this.style.setProperty('height', ''+imgHeight+'px', 'important'); } else if ( jQuery(this).hasClasses("box-double-txt-image") ) { divHeight = jQuery(this).children("img").outerHeight(); // alert(divHeight); // jQuery(this).css("height","0"); // jQuery(this).css("height",""+divHeight+"px"); this.style.setProperty('height', ''+divHeight+'px', 'important'); } }); jQuery("#boxes a").each(function() { if ( jQuery(this).children("div").hasClasses("box-single-image") ) { imgHeight = jQuery(this).children("div").children("img").outerHeight(); // jQuery(this).children("div").css("height","0"); // jQuery(this).children("div").css("height",""+imgHeight+"px"); this.style.setProperty('height', ''+imgHeight+'px', 'important'); } else if ( jQuery(this).children("div").hasClasses("box-double") ) { divHeight = jQuery(this).children("div").children(".content").height(); // alert(divHeight); // alert("A"); // jQuery(this).children("div").css("height","0"); // jQuery(this).children("div").css("height",""+divHeight+"px"); this.style.setProperty('height', ''+divHeight+'px', 'important'); } // if ( jQuery(this).children("div").children("div").hasClasses("content-color-blue") ) { // jQuery(this).children("div").css("background-color","rgba(0, 148, 206, 0.9)"); // } }); } function boxesNormal() { jQuery("#boxes div").each(function() { if ( jQuery(this).hasClasses("box-single-image") ) { this.style.setProperty('height', '293px', 'important'); } else if ( jQuery(this).hasClasses("box-double-txt-image") ) { this.style.setProperty('height', '293px', 'important'); } }); jQuery("#boxes a").each(function() { if ( jQuery(this).children("div").hasClasses("box-single-image") ) { this.style.setProperty('height', '293px', 'important'); } else if ( jQuery(this).children("div").hasClasses("box-double") ) { this.style.setProperty('height', '293px', 'important'); } }); } if (jQuery(document).width() <= 660) { boxesSmall(); } else { // boxesNormal(); } var $container = $('#boxes'); $container.isotope({ layoutMode: 'fitRows', masonry: { gutter: 10, isFitWidth: true }, itemSelector: '.box', sortBy: 'width', // isFitWidth: true, filter: '*', getSortData: { number: function( $elem ) { var number = $elem.hasClass('box') ? $elem.find('.number').text() : $elem.attr('data-number'); return parseInt( number, 10 ); }, width : function( $elem ) { return $elem.width(); } } }); // var isiPad = navigator.userAgent.match(/iPad/i) != null; // if(isiPad) { // alert("A"); // } jQuery("#boxes div").each(function() { if ( jQuery(this).hasClasses("box-triple-image-text") ) { var imgSrc = jQuery(this).children("img").attr("src"); // jQuery(this).addClass("box-image"); jQuery(this).css("background","url("+imgSrc+") no-repeat center center"); } }); function loadIsotope() { if(jQuery(window).outerWidth() > 1900) { $container.isotope({ filter: '*', sortBy: 'number' }); } else if(jQuery(window).outerWidth() >= 1080) { $container.isotope({ filter: '.box-single, .box-double, .box-triple-image-text', sortBy: 'number' }); } else if(jQuery(window).outerWidth() < 1280 && jQuery(window).outerWidth() > 1024) { $container.isotope({ masonry: { columnWidth: $container.width() / 3 }, filter: '*', sortBy: 'number' }); } else if(jQuery(window).outerWidth() <= 1024 && jQuery(window).outerWidth() > 980) { $container.isotope({ masonry: { columnWidth: $container.width() / 2 }, filter: '.box-single, .box-double, .box-tripe-image, .box-triple-image-text', sortBy: 'number' }); } else if(jQuery(window).outerWidth() < 981 && jQuery(window).outerWidth() > 660) { $container.isotope({ resizable: true, masonry: { columnWidth: $container.width() / 2 }, filter: '.box-single, .box-double, .box-tripe-image, .box-triple-image-text', sortBy: 'number' }); } else if(jQuery(window).outerWidth() <= 660 ) { $container.isotope({ masonry: { columnWidth: 620 }, filter: '.box-single, .box-double, .box-tripe-image, .box-triple-image-text', sortBy: 'number' }); } else if(jQuery(window).outerWidth() <= 320 ) { $container.isotope('destroy'); } } loadIsotope(); jQuery(window).bind('orientationchange', function (e) { switch (window.orientation) { case 0: break; case 90: loadIsotope(); break; case -90: loadIsotope(); break; } }); jQuery(window).smartresize(function(){ if(jQuery(window).outerWidth() > 1024 && jQuery(window).outerWidth() != 1080) { $container.isotope({ filter: '*', sortBy: 'number' }); } else if(jQuery(window).outerWidth() == 1080) { $container.isotope({ filter: '.box-single, .box-double, .box-triple-image-text', sortBy: 'number' }); } else if(jQuery(window).outerWidth() < 1280 && jQuery(window).outerWidth() > 1024) { $container.isotope({ masonry: { columnWidth: $container.width() / 3 }, filter: '*', sortBy: 'number' }); } else if(jQuery(window).outerWidth() <= 1024 && jQuery(window).outerWidth() > 980) { $container.isotope({ masonry: { columnWidth: $container.width() / 3 }, filter: '.box-single, .box-double, .box-tripe-image, .box-triple-image-text', sortBy: 'number' }); }else if(jQuery(window).outerWidth() < 981 && jQuery(window).outerWidth() > 660) { $container.isotope({ resizable: true, masonry: { columnWidth: $container.width() / 2 }, filter: '.box-single, .box-double, .box-tripe-image, .box-triple-image-text', sortBy: 'number' }); } else if(jQuery(window).outerWidth() <= 660 ) { $container.isotope({ masonry: { columnWidth: 620 }, filter: '.box-single, .box-double, .box-tripe-image, .box-triple-image-text', sortBy: 'number' }); } else if(jQuery(window).outerWidth() <= 320 ) { $container.isotope('destroy'); } }); function menuMargin() { var logoPos = jQuery(".header-container .title").position(); var menuMargin_val = logoPos.left+5; console.log(menuMargin_val); jQuery('.navigation ul').each(function () { this.style.setProperty( 'left', ''+menuMargin_val+'px', 'important' ); }); jQuery('.navigation ul').style.setProperty( 'left', ''+menuMargin_val+'px', 'important' ); } function langMargin() { var langPos = jQuery(".icons").position(); // var dupa = jQuery("#lang-sw").html(); // console.log(langPos); var langMargin_val = langPos.left; console.log(langMargin_val); // alert(menuMargin_val); // jQuery('.navigation ul').each(function () { // jQuery("nav.lang ul").style.setProperty( 'left', ''+langMargin_val+'px', 'important' ); jQuery("nav.lang ul").css( 'left', ''+langMargin_val+'px'); // }); } function mobileMenu() { } // menuMargin(); langMargin(); jQuery(window).resize(function() { // menuMargin(); // langMargin(); }); jQuery(window).resize(function() { if (jQuery(window).width() <= 660) { boxesSmall(); } else { boxesNormal(); } if (jQuery(window).width() <= 980) { jQuery(".navigation").hide(); } else { jQuery(".navigation").show(); } }); jQuery("#menu-sw").click(function() { jQuery(".navigation").toggle(); }); jQuery("#lang-sw").click(function() { if(jQuery(".lang").is(":hidden")) { jQuery(".lang").css("display","block"); } else { jQuery(".lang").css("display","none"); } }); });