Results 1 to 10 of 10

Thread: Problem with 'Drop down/ Overlapping Content script'

  1. #1
    Join Date
    Jun 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Problem with 'Drop down/ Overlapping Content script'

    Hi! I want to use the Drop down/ Overlapping Content script (http://www.dynamicdrive.com/dynamici...lapcontent.htm)
    to open a small window for a preview-like window.

    As I have to limit the size of the parent div container with a overflow:auto
    the popup is hidden.

    How to bring the window to the front in IE (FF is working)?

    This is the example page:
    http://www.youpi.de/overlap.htm

    (The windows div tag can not be put outside of the overflow div container as the links are generated by my software)
    Last edited by martib; 06-30-2007 at 02:07 AM. Reason: specify IE/FF

  2. #2
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Seems to be working for me...
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  3. #3
    Join Date
    Jun 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    sorry, forgot to specify in IE (in FF it's working)

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    In IE, the line:

    Code:
    wMessageWindow.focus();
    seems to be the problem here. Try removing it. IE is returning a "Can't focus" error.

  5. #5
    Join Date
    Jun 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    no, i removed all the lines but it did not help.

    i think the problem comes from the 'style="overflow:auto"'.
    is there a way to bring the overlapping in front (z-index did not work, or i used it wrong)
    Last edited by martib; 07-01-2007 at 03:33 AM. Reason: typo

  6. #6
    Join Date
    Jun 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hallo? Anyone?

    I am sure it is an easy piece of code. But which?

  7. #7
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    My mistake- the problem in IE is due to the fact that the drop down DIVs are contained inside the scrolling DIV. This creates a container relationship in IE that makes the child DIVs appear beneath the main. Move all of your drop down DIVs outside your <TABLE> tag so they're no longer children of the scrolling DIV, such as directly above the </BODY> tag. For example:


    Code:
    <DIV id=subcontent1169670486 
            style="BORDER-RIGHT: blue 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: blue 1px solid; DISPLAY: none; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; BORDER-LEFT: blue 1px solid; WIDTH: 300px; PADDING-TOP: 4px; BORDER-BOTTOM: blue 1px solid; POSITION: absolute; BACKGROUND-COLOR: white; z-index: 100"><IFRAME 
            border=0 src="test_files/yahoo.htm" width=290 height=200></IFRAME>
            <DIV align=right><A 
            onclick="overlayclose('subcontent1169670486'); return false" 
            href="http://www.youpi.de/overlap.htm#">Close</A></DIV></DIV>
    
    </body>

  8. #8
    Join Date
    Jun 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for having another look into that problem.

    yes, i know that would work, but as i mentioned the windows div (drop down DIV) tag can not be put outside of the overflow div container as the links are generated by my software. :-/

    is there a way to break the parent / child relation in IE?

  9. #9
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Ah right, I neglected to consider that part of your problem. One solution I can think of is to manually define a DIV that's outside your scrolling DIV at the bottom of your page's source, for example:

    Code:
    <div id="actualcontent" style="position:absolute; border: 1px solid blue; background-color: white; width: 300px; padding: 4px; display:none; z-index:100;">
    
    </body>
    Then, modify the script to grab the HTML contained inside the original DIVs, and display it inside the DIV we just added instead. To do this, change the original script to the following version instead:

    Code:
    <script type="text/javascript">
    
    /***********************************************
    * Drop Down/ Overlapping Content- &#169; Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    function getposOffset(overlay, offsettype){
    var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
    var parentEl=overlay.offsetParent;
    while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }
    
    function overlay(curobj, subobjstr, opt_position){
    if (document.getElementById){
    var subobjcontent=document.getElementById(subobjstr).innerHTML
    var subobj=document.getElementById("actualcontent")
    subobj.innerHTML=subobjcontent
    subobj.style.display=(subobj.style.display!="block")? "block" : "none"
    var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0)
    var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
    subobj.style.left=xpos+"px"
    subobj.style.top=ypos+"px"
    return false
    }
    else
    return true
    }
    
    function overlayclose(subobj){
    document.getElementById("actualcontent").style.display="none"
    }
    
    </script>
    I did a quick test in IE and Firefox, and it seems to work.

  10. #10
    Join Date
    Jun 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    nicely done!

    thank you!

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
  •