$(document).ready(function() { // Optimalisation: Store the references outside the event handler: //var isMobile = window.matchMedia("only screen and (min-device-width : 320px) and (max-device-width : 568px) and (orientation : portrait)"); var $window = $(window); var $width = $('#container,#contentholder,#contentholder_content_left'); function checkWidth() { var windowsize = $window.width(); if (windowsize < 980) { if($('nav').css('display') == 'none' ? false : true) { $('nav').hide(); } /*if((windowsize) >= 788 ){ $width.css("width", (windowsize - 160)+"px"); } else { $width.css("width", (windowsize - 16)+"px"); }*/ } else if($('nav').css('display') == 'none' ? true : false) { $('nav').show(); } if (windowsize < 485) { /*$("#container").css("margin","0px 8px");*/ var fullwidth = parseInt($(".block.only-mobile").css("width")); $(".centered-table td").css("width", fullwidth - 8+"px"); } else { /*$("#container").css("margin","auto");*/ } } // Execute on load checkWidth(); // Bind event listener $(window).resize(checkWidth); $('.mobilenav').click(function(){ isVisible = ( $('nav').css('display') == 'none' ? false : true ); if(isVisible){ $('nav').hide(); } else { $('nav').show(); } }); //was 141 $('.main ul .tooltip').hover( function(){ var $tooltip = $(this).find('span'); var position = $(this).position(); $tooltip.css({ 'top' : position.top+'px', 'left' : (position.left+280)+'px' }); }) });