Results 1 to 5 of 5

Thread: DHTML Window Widget (v1.1) fixed position of popups

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

    Default DHTML Window Widget (v1.1) fixed position of popups

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

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

    3) Describe problem: I have 4 popups (divbox) on a single page and i want them to all open in the same position, right after an image on the page and not relative to the window viewpoint

    Can you please advice how i can achieve this?

    Thanks in advance

    Foundas

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Edit the main script at the end, comment out (red) the highlighted part as shown:

    Code:
    cleanup:function(){
    	for (var i=0; i<dhtmlwindow.tobjects.length; i++){
    		dhtmlwindow.tobjects[i].handle._parent=dhtmlwindow.tobjects[i].resizearea._parent=dhtmlwindow.tobjects[i].controls._parent=null
    	}
    	window.onload=null
    }
    
    } //End dhtmlwindow object
    
    //document.write('<div id="dhtmlwindowholder"><span style="display:none">.</span></div>') //container that holds all dhtml window divs on page
    window.onunload=dhtmlwindow.cleanup
    Next, after your picture, where you want these windows showing up, put this:

    HTML Code:
    <div id="dhtmlwindowholder" style="position:relative; display:inline;"><span style="display:none">.</span></div>
    Now, the DHTML windows will be written there. Just make sure that you don't call anything like:

    Code:
    <script type="text/javascript">
    var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://google.com", "Google Web site", "width=700px,height=450px,left=0px,top=0px,resize=1,scrolling=1,", "recal")
    </script>
    until after the added HTML code we just put in after your picture. Something like this:

    Code:
    <a href="#" onClick="ajaxwin=dhtmlwindow.open('ajaxbox', 'ajax', 'external.htm', 'Ajax Win Title', 'width=650px,height=400px,left=0px,top=0px,resize=0,scrolling=1'); return false">Create/ Open Ajax Window</a>
    can go anywhere, but will not work until after the browser has parsed the added HTML code, so best to keep those kind of things after the added HTML code as well.

    Notice how in both calls to dhtmlwindow.open() that I've set the top and left to 0px. This should make them appear right at the spot where we added the new (moved actually) dhtmlwindowholder division.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    Default

    Hi John,

    thanks for the reply. I tried what you suggested, the window does appears where the div is defined, but if you scroll down on the page, and click the link again to open the popup, the position changes.

    Foundas

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Ah, yes. That would be because the scroll distance of the page is automatically added to the window. You can alter that in your stylesheet by using the unique id of the (each) window. For example, if you use:

    Code:
    googlewin=dhtmlwindow.open("googlebox", "iframe", "http://google.com", "Google Web site", "width=700px,height=450px,left=0px,top=0px,resize=1,scrolling=1,")
    Then googlebox is the unique id for that window, so you can put this in your stylesheet:

    Code:
    #googlebox {
     top: 0!important;
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Foundas (02-14-2009)

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

    Default

    thanks John,

    worked like a charm

    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
  •