Results 1 to 5 of 5

Thread: Amazon style dropin box - can we add a delay?

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

    Default Amazon style dropin box - can we add a delay?

    1) Amazon style drop in box

    2) http://www.dynamicdrive.com/dynamici...amazondrop.htm

    3) Describe problem:

    I've been trying to add a time delay to this.......can anyone help please?

    many thanks

  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

    Add this (highlighted) configuration item:

    Code:
    /***********************************************
    * Amazon style Drop-in content box-  Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * Visit DynamicDrive.com for hundreds of DHTML scripts
    * This notice must stay intact for legal use
    * Go to http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    var dropboxleft=200 //set left position of box (in px)
    var dropboxtop=100 //set top position of box (in px)
    var dropspeed=15 //set speed of drop animation (larger=faster)
    var dropdelay=1000 //set period of delay before drop (milliseconds, use 0 for no delay)
    
    //Specify display mode. 3 possible values are:
    //1) "always"- This makes the fade-in box load each time the page is displayed
    //2) "oncepersession"- This uses cookies to display the fade-in box only once per browser session
    //3) integer (ie: 5)- Finally, you can specify an integer to display the box randomly via a frequency of 1/integer...
    // For example, 2 would display the box about (1/2) 50% of the time the page loads.
    
    var displaymode="always"
    
    ///Don't edit beyond here///////////
    Then in the function initboxv2, add the highlighted lines:

    Code:
    function initboxv2(){
    if (!dom&&!ie)
    return
    if (dropdelay){
    setTimeout(initboxv2, dropdelay);
    dropdelay = 0;
    return;
    }
    crossboxcover=(dom)?document.getElementById("dropinboxv2cover") : document.all.dropinboxv2cover
    crossbox=(dom)?docume . . .
    - John
    ________________________

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

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

    Default troubleshooting

    thanks for the fast response.

    I've implemented as follows......but its doesn't work now. Any suggestions. Again thanks.

    function initboxv2(){
    if (!dom&&!ie)
    return
    if (dropdelay){
    setTimeout(initboxv2, dropdelay);
    dropdelay = 0;
    return;
    }
    crossboxcover=(dom)?document.getElementById("dropinboxv2cover") : document.all.dropinboxv2cover
    crossbox=(dom)?document.getElementById("dropinboxv2"): document.all.dropinboxv2
    scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
    crossbox.height=crossbox.offsetHeight
    crossboxcover.style.height=parseInt(crossbox.height)+"px"
    crossbox.style.top=crossbox.height*(-1)+"px"
    crossboxcover.style.left=dropboxleft+"px"
    crossboxcover.style.top=dropboxtop+"px"
    crossboxcover.style.visibility=(dom||ie)? "visible" : "show"
    dropstart=setInterval("dropinv2()",50)

    }

  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

    Quote Originally Posted by goodfella View Post
    thanks for the fast response.

    I've implemented as follows......but its doesn't work now. Any suggestions. Again thanks.

    function initboxv2(){
    if (!dom&&!ie)
    return
    if (dropdelay){
    setTimeout(initboxv2, dropdelay);
    dropdelay = 0;
    return;
    }
    crossboxcover=(dom)?document.getElementById("dropinboxv2cover") : document.all.dropinboxv2cover
    crossbox=(dom)?document.getElementById("dropinboxv2"): document.all.dropinboxv2
    scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
    crossbox.height=crossbox.offsetHeight
    crossboxcover.style.height=parseInt(crossbox.height)+"px"
    crossbox.style.top=crossbox.height*(-1)+"px"
    crossboxcover.style.left=dropboxleft+"px"
    crossboxcover.style.top=dropboxtop+"px"
    crossboxcover.style.visibility=(dom||ie)? "visible" : "show"
    dropstart=setInterval("dropinv2()",50)

    }
    That's only the second half of my code changes. Did you institute the first section? Without both parts, that second part will only cause an error. If you have instituted both parts faithfully, then there is either some problem with my idea, or a typo/error on one or the other or both our parts. Whatever the case:

    Please post a link to the page on your site that contains the problematic code so we can check it out.


    I know the concept is sound. We just need to get it working for you.

    Edit: Added later:

    I just tested my own advice. Works fine here.

    If you do follow everything I outlined, you may want to try:

    Code:
    var dropdelay=5000 //set period of delay before drop (milliseconds, use 0 for no delay)
    for the first part. That would be a 5 second delay, so much more noticeable than the 1000 millisecond (1 second) delay my original code provides.
    Last edited by jscheuer1; 08-17-2008 at 10:50 PM. Reason: add info
    - John
    ________________________

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

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

    Default Thanks

    My apologies, I was being a dumbass.

    I had set it to once per session.....and had not initiated a new session to test.

    Appreciated.

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
  •