Thursday, 15 April 2010

php - Change the whole content of site depending on monitor resolution -


In my site, I am applying a stylesheet based on the viewer's monitor resolution. I do this by using the screen.width in javascript. But now I suspect that I can use the same technique to change the entire contents of the site on the basis of resolution, i.e. for higher resolution more content and less, less Or please suggest me some other techniques to do this.

You can find the resolution and use it for a class of your page body Apply and use it to show / hide CSS in some columns. I can provide sample code if you tell me which framework / any framework you are not working with.

Here is the basic example in plain javascript:

  window.onload = function () {var resolution = 'res' + screen.width; Document.getElementsByTagName ('body') [0] .className = Resolution; }  

The advantage of this is that any page will always be displayed whether Javascript is enabled or not. If Javascript is enabled, you can create the page at a resolution, if the user will still see your content.


No comments:

Post a Comment