...

View Full Version : Adaptive Layout w/JS



twodayslate
12-23-2008, 05:51 AM
http://www.alistapart.com/articles/switchymclayout/
But without javascript.


greater than 800x600
|maincontent||sidebar|
|maincontent||sidebar|
|maincontent||sidebar|
|maincontent||sidebar|

less than 800x600
---------------
sidebarsidebar
---------------
|maincontent|
|maincontent|
|maincontent|
|maincontent|

links? pretty sure the old wordpress.com layout did this.

BoldUlysses
12-23-2008, 02:04 PM
I don't have a link for you, but I do have a comment. The technique is pretty cool, whether with JS or without, but wouldn't it compromise the usability of the site somewhat? I mean, if I was in the middle of reading an article and had to resize the browser window for whatever reason and the layout changed that dramatically, not only would I probably lose my place in the article, I might even think that I had somehow moved to a new webpage. Even if it's as simple as reorienting the navigation bar, it's changing the configuration of links people are used to on a more user-discretionary level than something like a full site redesign (where one would expect some usability changes).

Just thoughts. I would like to know how to do it with pure CSS (if it's even possible).

twodayslate
12-23-2008, 05:40 PM
I am not worried about people loosing their place in the article or not recognizing the site. the sidebar is say 150px wide when it is on the right so their article would only be shifted down 150px - not that much of a change.
This is mainly for people with small resolutions. How many people go to 800x600 when they have a 19" monitor - not many.

Thanks for the input though!

;)

Excavator
12-23-2008, 05:55 PM
Kind of a cool idea...
This works in FF3, IE7 and IE8. I know it won't in IE6 so I didn't even look.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
background: #FC0;
text-align:center;
font: 12px "Comic Sans MS";
}
* {
margin: 0;
padding: 0;
border: none;
}
#container {
background: #6F9;
overflow: auto;
}
.wrap {
min-width: 150px;
max-width: 400px;
margin: 20px 5px;
border: #F00 2px solid;
float: left;
background: #fff;
}
</style>
</head>
<body>
<div id="container">
<div class="wrap">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo
duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</p>
<!--end wrap--></div>
<div class="wrap">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo
duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</p>
<!--end wrap--></div>
<div class="wrap">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo
duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</p>
<!--end wrap--></div>
<!--end container--></div>
</body>
</html>


A small point twodays, the content would drop the height of the left column, not the 150px width.

twodayslate
12-23-2008, 10:10 PM
that is just pushing floats - no change of style/look
but what if the container is a %
content is say 70% and sidebar is 150px;

more: http://www.colly.com/comments/redesign-notes-12-width-based-layout (comments are good)

harbingerOTV
12-23-2008, 10:48 PM
http://tugbucket.net/tests/adapt/adapt.html

super quirky but, it's a start. Only tested in FF2 as it's well, quirky. To many drawbacks to take it too seriously yet.

twodayslate
12-24-2008, 04:06 AM
http://tugbucket.net/tests/adapt/adapt.html

super quirky but, it's a start. Only tested in FF2 as it's well, quirky. To many drawbacks to take it too seriously yet.
I don't see what that is trying to accomplish. please explain.
w/FF3

thanks!

harbingerOTV
12-24-2008, 06:49 AM
alright. if you have your content first in the HTML order and then the sidebar, why would you ever want the sidebar content to come before your content? this is assuming that the side is navigation and superfluous information. What i was trying to achieve was something like content first. then navigation. then extras. with pure CSS it's going to be tough.

If you want a fluid layout, design for it. If you want JS to handle some of the brunt of it, let it. I played for a bit and couldn't get what you wanted to go the way you wanted it to go with just CSS so take it as either a) i don't understand what you want or b) you don't

twodayslate
12-24-2008, 04:51 PM
alright. thanks for the help anyway.
peace.


edit:// decided to use JS. As long as they still have CSS enabled the site looks fine.
:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum