Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Question Expandable Divs with html/css

    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

  • #2
    Regular Coder
    Join Date
    Dec 2005
    Posts
    149
    Thanks
    12
    Thanked 0 Times in 0 Posts
    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-expa...apse-div-menu/

    Good Luck
    Tomorrow Could Be Your Day

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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, but I don't think there's a way of doing it with pure CSS/HTML.

  • #4
    New Coder
    Join Date
    May 2009
    Posts
    74
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by greens85 View Post
    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,
    Last edited by frankle; 06-03-2009 at 01:33 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •