Click to See Complete Forum and Search --> : Drop-in box


Duke Will
09-05-2003, 08:05 AM
Installed drop-in box script from Dynamic Drive (http://www.dynamicdrive.com/dynamicindex17/dropinbox.htm) and it's working pretty good on WePay.com (http://www.wepay.com).

1. Could I make this box drop-in upon the person EXITING the site, not upon ENTERING?

I would like to do the above. If #2 below could be done, that would be even better.

2. Could I time it so it doen't drop-in for like 60 seconds after load?

3. Could I have BOTH drop-ins? I mean, two different boxes. With different messages. One upon load or maybe 60 seconds later, the other upon exit.

Khalid Ali
09-05-2003, 08:57 AM
I don't see why you can not do that.

use the setTimeout() function to add a adelay.

to use it on unload may not be as consistent as you might think(browsers handle onunload differently)

Duke Will
09-05-2003, 09:42 AM
I know only some html, so I don't know how to do this. If anyone can advise, thanks. The last statement in the part that goes in the HEAD tag is...

window.onload=initbox

The entire part that goes in the head tag is...

<script language="JavaScript1.2">

// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use

var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"

var bouncelimit=32 //(must be divisible by 8)
var direction="up"

function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}

function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+40+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function truebody(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}


window.onload=initbox

</script>

Duke Will
09-07-2003, 09:41 PM
Would someone puhleeze look at WePay.com (http://www.wepay.com). All by my lonesome, I tried to figure out how to put a delay in there and I was proud. heehee. I thought i did it but some guy emailed me all pissed off at all of my 'warning pages.' THen I went back and looked in Opera and it did the popup upon load, I guess, and also 60 seconds later. I only want it to popup 60 seconds after load. I put that setTimeout deal in there and also added a bit in the BODY tag. Realize I am not a javascript programmer, so I do not know proper syntax. I just winged it.

Khalid Ali
09-08-2003, 07:36 AM
remove this line from your javascript code

window.onload=initbox


then add the following in your body tag

onload="setTimeout('initbox()',30000)"

the above should delay the drop in thing for 30 secs when page loads.

Duke Will
09-08-2003, 07:59 AM
There are TWO lines exactly like that. Remove both?

Khalid Ali
09-08-2003, 08:07 AM
yes remove them both

Duke Will
09-08-2003, 08:26 AM
The BODY tag already contained...

onload="pause()"

Remove this or leave it?

I assume you have been looking at source code in my actual page. (I just uploaded it again with the changes and I removed the onload="pause()" part.

Duke Will
09-08-2003, 08:35 AM
Well, I just checked it in Opera and it did drop the box down 30 sec after load. Seems to me I have some redundant code, since up toward the top I am telling it to drop down in 60 sec. I would think that needs to be removed. I assume what you provided is overriding that top part.

Why is this thread so wide onscreen?

Khalid Ali
09-08-2003, 08:41 AM
Does it work now?

Duke Will
09-08-2003, 12:11 PM
Yes, thank you, it appears to work. Although, I question my having it all goofed up. I mean, it appears to be working but I have that code in the HEAD tag that seems to be redundant, maybe. i dunno. If it works, i guess it's okay.

Khalid Ali
09-08-2003, 12:20 PM
cool....glad to be of help