Best approach for loading a sidebar Only if the screen max-width is >900px?

On my website I load the recent comments per AJAX for window sizes above 480px:

if ( 480 < jQuery(window).width() )
{
    jQuery(document).ready(
        function()
        {
            jQuery.get('http://toscho.de/?rc', 
                function(data)
                {
                    jQuery(data).insertBefore('#inner');
                }
            );
        }
    );
    jQuery('#posts').after('<div class=clear>&#160;</div>');
}

This code is quite old and not very elegant. But it may give you a hint for the right direction …

Leave a Comment