PDA

View Full Version : Need "Drop-down" already dropped down



Robert
06-10-2008, 05:00 PM
1) Amazon style Drop-in content box-

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

3) I've been using (and enjoying using) Dynamicdrive scripts for years, but just signed up today. Recently I tried to adapt the Amazon style Drop-in content box for use on this page:
www.potato2008.org/en/kids/potatoshow.html

I needed the "curtain" to cover, initially, the content in an iframe "underneath" and then "open" onclick. I couldn't find anything like that here, but I did find the Amazon style drop-in content box script, which at least lets you "remove the curtain" <div id="dropinboxv2"> by clicking on it.

The problem is, what I don't need the content box to do is "drop down", which of course it was designed to do - I need it on the page, in place, as soon as the page loads. Since I couldn't figure out how to do that, I set the var dropspeed=5000, so it loads in place in the blink of an eye, but a blink is still just a bit too slow.

Can anyone suggest a way to remove the script's drop-down function, leaving only the onclick="dismissboxv2();" ? Or IS there a simple "Close me" script on the site somewhere?

thanks, and thanks DD for a great site
Robert

ddadmin
06-11-2008, 07:10 PM
If you want the content box to immediately show up (instead of dropping down), try just replacing everything inside function dropinv2(), the part in red:


function dropinv2(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossbox.style.top)<0){
crossboxcover.style.top=scroll_top+dropboxtop+"px"
crossbox.style.top=parseInt(crossbox.style.top)+dropspeed+"px"
}
else{
clearInterval(dropstart)
crossbox.style.top=0
}
}

with the line:


crossbox.style.top=0

Robert
06-11-2008, 08:00 PM
If you want the content box to immediately show up (instead of dropping down), try just replacing everything inside function dropinv2(), the part in red:


function dropinv2(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossbox.style.top)<0){
crossboxcover.style.top=scroll_top+dropboxtop+"px"
crossbox.style.top=parseInt(crossbox.style.top)+dropspeed+"px"
}
else{
clearInterval(dropstart)
crossbox.style.top=0
}
}

with the line:


crossbox.style.top=0

...thanks for the suggestion, I tried it (on a local copy, not the site) but alas, it didn't eliminate the delay between page load and the "drop down". So, I just tried deleting likely-looking chunks of code relative to "function initboxv2()" , namely:

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"

...and now it "drops" in a quarter of a blink of an eye in Firefox and the drop is absolutely imperceptible in IE7. Gee, problem solved...

ddadmin
06-11-2008, 08:37 PM
Well, the delay before the box actually appears on the page when the page loads first loads is a separate issue. Basically, the script is run when the page has fully loaded, so it can correctly get the dimensions of the box. Depending on what's contained inside the box, you may be able to get away with calling the script earlier than that...

Robert
06-12-2008, 02:01 PM
Would be possible to do a javascript that does nothing else but onclick="dismiss" a covering div? That would be useful in some situations.

Thanks for the help.

ddadmin
06-12-2008, 09:09 PM
It depends on what you mean by "a covering div". In general JavaScript can certainly hide any DIV on the page onClick. Based on what you talked about earlier, you may be interested in the following script: http://www.javascriptkit.com/script/script2/postit.shtml

Robert
06-13-2008, 10:08 PM
That looks like the one. Thanks.