Par |ben|, mercredi 29 mars 2006 à 22:59 :: Web Développement :: #70 :: rss
Adapter votre webdesign à la taille de la fenêtre de l'internaute
Je viens de lire un article intéressant sur la gestion du design en fonction de la taille de l'affichage de la fenêtre (écran, widescreen) de l'internaute : digital-web.com.
Il est mis a disposition un javascript qui change de CSS en fonction de la taille de la fenetre d'affichage : exemple
le header de l'exemple :
<link rel=STYLESHEET href=stylesmall.css type=text/css>
<link rel=STYLESHEET href=stylebig.css type=text/css>
<link rel=STYLESHEET href=stylehuge.css type=text/css><script language="JavaScript">
<!--function dynamicStyle() {
//var w = (d.all) ? d.body.clientWidth : innerWidth;
//alert(w)
var screenW = (document.body) ? document.body.clientWidth : innerWidth
var theStyle = (screenW > 1250) ? 'huge' : (screenW > 1000) ? 'big' : 'small';
//alert(screenW + ' ' + document.body.clientWidth)
var i, a;
for (i = 0; a = document.getElementsByTagName('link')[i]; i++) {
if (a.getAttribute('href').indexOf(theStyle) != -1) {
a.disabled = false;
} else {
a.disabled = true;
}
}
}window.onload = window.onresize = dynamicStyle;
//-->
</script>
<style>
#primary {padding: 250px 0 475px 0; text-align:center; border:2px solid #cccccc;}
#box {padding: 50px 0; text-align:center;}
#box2 {padding: 50px 0; text-align:center;}
</style>
</head>
le body de l'exemple :
<div id="primary">Main Content Area : Fixed Width (750px wide) </div>
<div id="secondary">
<div id="box"> Content Area </div>
<div id="box"> Content Area </div>
<div id="box"> Content Area </div>
<div id="box2"> Content Area </div>
<div id="box2"> Content Area </div>
<div id="box2"> Content Area </div>
</div>
<div id="tertiary"><strong>About the Author</strong><br>
Mike Madaio claims to publish witty musings on user experience, usability and
emerging technologies at <a href="http://mikemadaio.com">his blog</a>.
During the few waking hours he spends away from an internet connection, he enjoys eating
sandwiches and spending time at the <a href="http://philadelphiacurlingclub.org">local
curling club</a>. </div>
Article suivant de la même catégorie >> Lire la suite via l'extension (exp...
Commentaires
Aucun commentaire pour le moment.
Ajouter un commentaire
Les commentaires pour ce billet sont fermés.