...

View Full Version : Expandable Divs with html/css



greens85
06-03-2009, 11:06 AM
Hi all,

Is it possible to build user interactive expandable divs using html/css?

By this i mean the divs shows something like, 'read more' which is a link. And when clicked the divs expands to show the whole content?

I thought this might be possible with the overflow property in some way but im not too great at html/css.

Any advice would be appreciated.

thanks

Genie1
06-03-2009, 11:34 AM
Hi,

Iv looked around, and this one is the one i would recomend, you may need to amend it, to your specification.

http://www.dustindiaz.com/dhtml-expand-and-collapse-div-menu/

Good Luck

hey_hudson
06-03-2009, 11:45 AM
I've got something that sounds close to what you want on my website (sorry for the shameless plug!)

http://www.heyhudson.com

Really easy to do with jQuery (http://jquery.com), but I don't think there's a way of doing it with pure CSS/HTML.

frankle
06-03-2009, 12:30 PM
Hi all,

Is it possible to build user interactive expandable divs using html/css?

By this i mean the divs shows something like, 'read more' which is a link. And when clicked the divs expands to show the whole content?

I thought this might be possible with the overflow property in some way but im not too great at html/css.

Any advice would be appreciated.

thanks


Try using this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Frankle</title>
<script>
function ShowHide(elementId)
{
var element = document.getElementById(elementId);
if(element.style.display != "block")
{
element.style.display = "block";
}
else
{
element.style.display = "none";
}
}
function UpdateText(element)
{
if(element.innerHTML.indexOf("show1") != -1)
{
element.innerHTML = "<div>Expand</div>";
}
else
{
element.innerHTML = "<div id='show1'>Hide</div>";
}
}
</script>
</head>
<body>

<div style="width:200px;">
Sample text <br />
<a href="javascript:void(0);"onclick="ShowHide('divDetails');UpdateText(this);">Expand</a> </div>
<div id="divDetails" style="border:thin #ccc solid; padding:6px; display:none">
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. 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.
</div>
</body>
</html>


Let me know if this does not solve your problem
Tell others if it does

Regards,



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum