Results 1 to 6 of 6

Thread: Modal once per session not working

  1. #1
    Join Date
    Nov 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Modal once per session not working

    1) Script Title: DHTML Modal

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...dhtmlmodal.htm

    3) Describe problem:
    The modal window (iframe) is opening successfully, I have updated to use the "optional once per session" JS file and I have added the "sessiononly" to the script code.

    But the modal window is still opening each time the page is visited. What am I doing wrong? Thanks so much!

    Sample page: http://www.horsevideolibrary.com/01_...arn_stable.php

  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

    Well yes it appears you've updated the dhtmlwindow script to one that allows once per session. However, it's clear that the modal.js script isn't passing your parameter about the session on to the updated dhtmlwindow script. Now there could be other problems, but this is the first thing I would try - In modal.js find the open function as shown below and add the highlighted:

    Code:
    open:function(t, contenttype, contentsource, title, attr, recalonload, session){
    	var d=dhtmlwindow //reference dhtmlwindow object
    	this.interVeil=document.getElementById("interVeil") //Reference "veil" div
    	this.veilstack++ //var to keep track of how many modal windows are open right now
    	this.loadveil()
    	if (recalonload=="recal" && d.scroll_top==0)
    		d.addEvent(window, function(){dhtmlmodal.adjustveil()}, "load")
    	var t=d.open(t, contenttype, contentsource, title, attr, recalonload, session)
    	t.controls.firstChild.style.display="none" //Disable "minimize" button
    	t.controls.onclick=function(){dhtmlmodal.close(this._parent, true)} //OVERWRITE default control action with new one
    	t.show=function(){dhtmlmodal.show(this)} //OVERWRITE default t.show() method with new one
    	t.hide=function(){dhtmlmodal.close(this)} //OVERWRITE default t.hide() method with new one
    return t
    },
    - John
    ________________________

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

  3. #3
    Join Date
    Nov 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Oops-different error now

    Hi John and thanks for getting back to me so quickly.

    I made the change to modal.js, but this is what is happening:

    1) on first open of the page, modal window plays fine;
    2) upon return to the page, the overlay background opens, no iFrame window, and no way to "get out" of the modal window.

    Any more suggestions? thanks again!

    Sample page: http://www.horsevideolibrary.com/01_...arn_stable.php

  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

    Whoopsie! I did say that there might be other problems, sheesh - was there ever. One more addition should take care of it:

    Code:
    open:function(t, contenttype, contentsource, title, attr, recalonload, session){
    	if(session && persistobj.getCookie(t)!=""){return}
    	var d=dhtmlwindow //reference dhtmlwindow object
    	this.interVeil=document.getElementById("interVeil") //Reference "veil" div
    	this.veilstack++ //var to keep track of how many modal windows are open right now
    	this.loadveil()
    	if (recalonload=="recal" && d.scroll_top==0)
    		d.addEvent(window, function(){dhtmlmodal.adjustveil()}, "load")
    	var t=d.open(t, contenttype, contentsource, title, attr, recalonload, session)
    	t.controls.firstChild.style.display="none" //Disable "minimize" button
    	t.controls.onclick=function(){dhtmlmodal.close(this._parent, true)} //OVERWRITE default control action with new one
    	t.show=function(){dhtmlmodal.show(this)} //OVERWRITE default t.show() method with new one
    	t.hide=function(){dhtmlmodal.close(this)} //OVERWRITE default t.hide() method with new one
    return t
    },
    There could still be another issue, but I think this will be it for this one.
    - John
    ________________________

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

  5. #5
    Join Date
    Nov 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    KUDOS! That is working perfectly on this one page. I will update all the pages now and we should be good to go! Thanks ever so much, as there's no way I would ever have figured this one out on my own.

  6. #6
    Join Date
    Nov 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    UPDATE! All is working perfectly on all pages with the code! Again, many thanks for you help.

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
  •