Sign in to follow this  
Michael Tanczos

Responsive Design Javascript

Recommended Posts

Michael Tanczos    5681

Adding this code to the site starts to make the site more size responsive on lower resolutions.. this is a work in progress:

 

[code] 

Event.observe(window, "resize", function() {
    var width = document.viewport.getWidth();
    var height = document.viewport.getHeight();
    var dims = document.viewport.getDimensions(); // dims.width and dims.height
 
    if (width < 1024)
    {
$$('.ipsLayout_right').each(Element.hide);
$$('.ipsLayout_withright').invoke('toggleClassName', 'ipsLayout_withright_disabled'); 
$$('.ipsLayout_withright').invoke('toggleClassName', 'ipsLayout_withright'); 
$$('.ipsLayout_content').invoke('toggleClassName', 'clearfix');
$$('#content,.main_width,#branding,#header_bar,#primary_nav').invoke('setStyle', { 'min-width': '0px' });
 
$$('#dark').invoke('setStyle', { 'overflow': 'hidden' });
        if (width < 800)
$('search').hide();
 
$('leaderboard').hide();
    }
    else
    {
$$('.ipsLayout_right').each(Element.show);
$$('.ipsLayout_withright_disabled').invoke('toggleClassName', 'ipsLayout_withright'); 
$$('.ipsLayout_withright_disabled').invoke('toggleClassName', 'ipsLayout_withright_disabled'); 
$$('.ipsLayout_content').invoke('toggleClassName', 'clearfix');
$$('#content,.main_width,#branding,#header_bar,#primary_nav').invoke('writeAttribute', 'style', '');
 
$('search').show();
$('leaderboard').show();
 
    }
});
[/code]
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this