function docentesSwap(){ var $docentes = $('.docentePic'); $docentes.each(function(){ var $this = $(this).children('.main'); var opacity = $this.css('opacity'); //alert(opacity); $this.css('opacity',Math.abs(opacity-1)); }); } function tictac(){ //alert(scrolled); if(scrolled) { var y = parseFloat($(window).scrollTop()); var menuTop = parseFloat($('.nav-container').css('top')); if(menuTop < y) { $('.nav-container').css({ 'position':'absolute', 'top': y }); $('#nav-logo').trigger('click'); scrolled = false; } } } $(document).ready( function() { $('.loaderOverlay').show(); scrollCounter = 0; timer = null; scrolled = false; timer= setInterval("tictac()", 5000); /* // Replace source $('img').error(function(){ $(this).attr('src', 'img/placeholder.jpg'); });*/ $('img').removeAttr('width').removeAttr('height'); var count = $("#menu-top > li").length; $("#menu-top > li").css('width', 100/count+"%"); $("#menu-top > li").css('max-width', 100/count+"%"); $('.thumbContainer').height($('.thumbContainer').width()); $('.docentePic .image').each(function(){ var height = $(this).outerWidth() + 'px'; /*alert('Normal: '+$(this).children('.main').width()); alert('Inner: '+$(this).children('.main').innerWidth()); alert('Outer: '+$(this).children('.main').outerWidth());*/ $(this).css({'height':height, 'width': height}); //$(this).parent('.docente').css('height',height); }); $('.projetos .image').each(function(){ var height = $(this).width() + 'px'; $(this).css({'height':height}); }); // Run our swapImages() function every 5secs if ( $('#checker').width() < 570 ){ setInterval('docentesSwap()', 5000); } // prevent parent menus from activating $('.wp-menu li').each(function(){ $(this).has('ul').children('a').addClass('prevent'); //alert($(this).has('ul').children('a').text()); }); $('.prevent').click(function(e){ e.preventDefault(); }); $('.listedPost').each(function(e){ var baseFont = parseFloat($(this).find('.postContent').css("font-size")); var divSize = parseFloat($(this).find('.postContent').css("height")); //alert(baseFont+'/'+divSize); var definedMH = $(this).find('.postContent').css("max-height"); if (definedMH === 'none') { definedMH = 9999; } else { definedMH = parseFloat(definedMH)/baseFont/10; } //alert(definedMH); if((divSize/baseFont)>definedMH) { $(this).find('.postContent').css("max-height",definedMH+"em"); $(this).find('.postMain').append(''); } //alert(divSize/baseFont + "em"); }); // activate items on click $('.wp-menu li').click(function(){ /*$(this).toggleClass('active') .siblings() .removeClass('active');*/ var active = $(this).hasClass('active'); if ( $('#checker').width() > 1024 ){ $('.nav-container').css({ 'position':'fixed', 'top': 0 }); } //alert(active); $(this).parents() .children('li') .removeClass('active'); if (!active) $(this).toggleClass('active'); }); $('.nav-container').bind("mouseenter", function(event) { if ( $('#checker').width() > 1024 ){ $('#wrapper').css('margin-left','240px'); $('#footer').css('padding-left','260px'); } }); $('.nav-container').bind("mouseleave", function(event) { if ( $('#checker').width() > 1024 ){ $('li').removeClass('active'); $('#wrapper').css('margin-left','55px'); $('#footer').css('padding-left','75px'); } }); $('#nav-logo').bind("click focus", function(event) { if ( $('#checker').width() < 1025 ){ var height = $('.nav-container').css('height'); //alert(height); if(height!='45px') { $('.nav-container').css('height','45px'); } else { $('.nav-container').css('height','auto'); } $('#main-menu').toggle('slide'); /* if (($('.nav-container').css('position')) === 'fixed') { var y = $(window).scrollTop(); $('.nav-container').css({ 'position':'absolute', 'top': y }); } else { $('.nav-container').css({ 'position':'fixed', 'top': 0 }); }*/ }; }); $('.listedPost .postMain .showMore').click(function(e){ //alert($(this).siblings('.postContent').text()); var max = $(this).siblings('.postContent').css('max-height'); if (max==='none') { $(this).siblings('.postContent').css('max-height','6em'); } else { $(this).siblings('.postContent').css('max-height','none'); } $(this).toggleClass('icon-plus').toggleClass('icon-minus'); }); }); $(window).load( function() { $(this).delay(500); $('.loaderOverlay').hide(); }); $(window).scroll( function() { if ( $('#checker').width() < 1025 ){ //alert(scrollCounter); clearInterval(timer); scrolled = true; timer= setInterval("tictac()", 2000); var y = parseFloat($(window).scrollTop()); var menuTop = parseFloat($('.nav-container').css('top')); var menuHeight = parseFloat($('.nav-container').outerHeight()); //alert(y+'/'+menuTop); if (menuTop > y) { $('.nav-container').css({ 'position':'absolute', 'top': y }); } else if (menuTop+menuHeight < y) { $('#main-menu').slideUp(); $('.nav-container').css({ 'position':'absolute', 'top': y }); //$('#nav-logo').trigger('click'); } } });