Dynamically adjusting div heigh with javascript.

Discussion in 'Web Design and Development' started by jdl8422, Sep 24, 2008.

  1. jdl8422 macrumors 6502

    jdl8422

    Joined:
    Jul 5, 2006
    Location:
    Louisiana
    #1
    I am currently doing a website that uses the coda slider for the main content. There are 6 or so navigation buttons on the top of the div layer. When you click on the nav, the content slides over using javascript. That part works fine. Does anyone know of a way to dynamically adjust the height of each new window that slides over. i want it to automatically adjust height based on content.

    Here is an example of the coda slider: http://www.ndoherty.com/demos/coda-slider/1.1.1/
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Looking at the implementation, it would be somewhat hard to do. The height of the window is based on the max height of the windows. Even though you're only viewing one window at a time, the others are still there so the CSS is accommodating them. You'd have to calculate the actual height being used by all of the content, which is doable, but can be a touch cumbersome and could be hard to integrate into the existing JavaScript code.

    I'm just giving you this info so you realize it's not a simple edit.
     
  3. jdl8422 thread starter macrumors 6502

    jdl8422

    Joined:
    Jul 5, 2006
    Location:
    Louisiana
    #3
    Thats what I thought. I thought it may be easier because each window has the same class called .panel. So I was curious if I could just use a seperate class for each window so there would be different heights. I'm not a javascript expert so I'm not 100% sure if its possible. Thanks
     

Share This Page