Jump to content

Using Javascript to alter resolution


nodster

Recommended Posts

Can it be done.

 

My website is best viewed at a high resolution, however i've had some comments that on a smaller screen/resolution i lose some of the page.

 

now i could redo the site for the lower resolution/screen size but this would take to long.

 

So does anyone know of a way to do this in javascript?  If indeed it is possible.

 

??? ???

Link to comment
https://forums.phpfreaks.com/topic/60053-using-javascript-to-alter-resolution/
Share on other sites

I've been thinking about this,

 

could javascript be used to determine the size of window available and then use that answer to load a certain css file, ie so that i could use a fixed background image for each size of window or is that too difficult a way to go about it?

 

Ta

???

Ok modifying it slightly (as i don't really understand the switch function)

 

Could somebody have a look at this code and see where i've gone wrong  :o  ???

 

<script language="javascript" type="text/javascript">

<!--

function checkCss() {

var cssNode = document.createElement('link');

cssNode.type = 'text/css';

cssNode.rel = 'stylesheet';

cssNode.media = 'screen';

cssNode.title = 'dynamicLoadedSheet';

document.getElementsByTagName("head")[0].appendChild(cssNode);

 

if

(document.body.clientWidth < 1000);

cssNode.href = 'http://website/small.css';

}else

 

(document.body.clientWidth < 1300);

cssNode.href = 'http://website/medium.css';

}

</script>

 

I have (for the time being) placed this into the <head> of my page but will be making it an external sheet was it works.

 

TIA

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.