Results 1 to 6 of 6

Thread: DHTML Window Widget (v1.1) - Fixed Position

  1. #1
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML Window Widget (v1.1) - Fixed Position

    1) Script Title: DHTML Window Widget (v1.1)

    2) Script URL (on DD): http://dynamicdrive.com/dynamicindex8/dhtmlwindow/

    3) Describe problem:
    I need the window to always appear in the same place on the page (ie, beside a certain image) rather than relative to the window viewpoint. Can anyone help me?

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

    Default

    Hi:
    Are you looking for all DHTML windows to be positioned relative to a specific (single) image on the page?

  3. #3
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, that's correct.

  4. #4
    Join Date
    Nov 2007
    Posts
    63
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    have you found or is there a solution for this? I too, wish to keep the popup in a fixed position and not relative to the viewing screen


    Thanks in advance

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

    Default

    There's actually a few threads on this already. Please do a search. For example, see my response here: http://www.dynamicdrive.com/forums/s...ad.php?t=25050
    DD Admin

  6. #6
    Join Date
    Nov 2007
    Posts
    63
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    Hi ddadmin,

    in your post, you provided the solution using id=test with this code:

    Code:
    <p id="test">
    This is some textThis is some textThis is some textThis is some textThis is some textThis is some text
    </p>
    
    <!-- 1) DHTML Window Example 1: -->
    
    <script type="text/javascript">
    
    var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://images.google.com/", "#1: Google Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")
    
    dhtmlwindow.getposOffset=function(what, offsettype){
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
    }
    return totaloffset;
    }
    
    var anchorelement=document.getElementById("test")
    
    googlewin.moveTo(dhtmlwindow.getposOffset(anchorelement, "left"), dhtmlwindow.getposOffset(anchorelement, "top"))
    
    </script>
    I tried it and it works great.

    Can you please advice how to change the code so that it will work with the following version of popups i use:

    Code:
    <a href="#" onClick="divwin=dhtmlwindow.open('divbox', 'div', first_popup, 'Free spirit', 'width=620px,height=155px,left=52px,top=462px,resize=0,scrolling=0'); return false"></a><br><br>
    
    <a href="#" onClick="divwin=dhtmlwindow.open('divbox', 'div', second_popup, 'Free spirit2', 'width=620px,height=155px,left=52px,top=462px,resize=0,scrolling=0'); return false"></a>
    Thanks in advance

    Foundas

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
  •