Results 1 to 3 of 3

Thread: DHTML Window Widget: Close Window-Layer(s) While Opening Another

  1. #1
    Join Date
    Oct 2007
    Location
    Statline, Nevada usa
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question DHTML Window Widget: Close Window-Layer(s) While Opening Another

    1+2) Script Title and URL (on DD):
    DHTML Window widget (v1.03)
    Thank you for this nice and very useful piece of work ;^)

    3) Describe problem: How to Close an already opened window layer, or several, in/with the opening action of a particular link, without having to reference the already open window(s) uniquely (like by uniqueID)?

    4) Details:
    I am using ajax. I tried using "ajaxwin.hide()" command in my event controls, but this doesn't always work and it gets messy.
    I was hoping to be able to insert some sort of code [elsewhere] into the dhtmlwindow.js file, probably under the open function, to simply globally control things so only one window is ever open at a time.
    Or better yet, place/build some code elsewhere in the js file so link code (in the html doc) can "choose" whether or not it wishes other window-layer(s) to be closed.

    What I finally ended up doing is to simply reuse the uniqueID for links I created so that they reuse the same window layer.
    This gives the illusion of the effect.
    However, as well as this seems to work (for now anyway) I am uncertain if this is the best solution or even good to be doing??
    Wouldn't it be better to be able to choose to specify in a link that, when clicked, 'it looks' to see if any other window-layers are present and if so, closes them (without having to know the specific id of each open window layer)?

    Cheers,
    TwoHawks

  2. #2
    Join Date
    Aug 2004
    Posts
    9,878
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    Inside dhtmlwindow.js, try adding the code in red to the existing function:

    Code:
    open:function(t, contenttype, contentsource, title, attr, recalonload){
    	for (var i=0; i<this.tobjects.length; i++){
    		if (this.tobjects[i]!=t)
    		this.tobjects[i].hide()
    	}
    This should work in general cases as far as closing all other windows (if any) before showing the current.

  3. #3
    Join Date
    Oct 2007
    Location
    Statline, Nevada usa
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Most excellent - that appears to address the issue succinctly.
    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
  •