SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: popup div code location and positioning..

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2008
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    popup div code location and positioning..

    i'm using javascript to show popup divs for certain features of my site.. currently I have them placed outside and under the site "wrapper". Though positioned absolutely, depending on the size of the wrapper, the popup divs height will be affected.

    So my question is.. where should i place these popup divs in order for them to be positioned consistently? If i place them above the wrapper they will be covered by the contents of the wrapper.

    anyone know what i'm missing?

    thanks a lot!

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    SitePoint Award Recipient Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    37,796
    Mentioned
    99 Post(s)
    Tagged
    3 Thread(s)
    Hi,

    We'd need to see your code to give appropriate advice.

    If by under your wrapper you mean they are hidden by the wrapper laying on top of the pop up this can be fixed by a correct use of z-index.

    Apply a z-index to the wrapper that is less than that of the pop up. (you will need to add position:relative to the wrapper if it is not positioned in order to gain a stacking context for z-index to take effect.)

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2008
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    paul, z-index works perfectly. Thank you so much!

    but i was wondering if this is the correct way to go about this technique. Is the way i'm handling simple popups divs a correct way of doing it? or is there better?

    Thanks again!

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2008
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry, i thought i included the code. The structure is as follows..

    Code HTML4Strict:
    <body>
     
       <div class="popup">popup1</div>
       <div class="popup">ICANHASPOPUP</div>
     
       <div id="wrapper">
          <div id="content">
              stuff!
          </div>
       </div>
    </body>

  5. #5
    The CSS Clinic is open silver trophybronze trophy
    SitePoint Award Recipient Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    37,796
    Mentioned
    99 Post(s)
    Tagged
    3 Thread(s)
    Hi,

    It depends on what type of pop ups they are and what they are doing. If they are the type that pop up when clicked then you will need javascript for that.

    If you want them to just pop up when hovered then you can do some things with css only.

    See my article here for some ideas of css pop ups.

Bookmarks

Posting Permissions

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