Results 1 to 7 of 7

Thread: Need "Drop-down" already dropped down

  1. #1
    Join Date
    Jun 2008
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Need "Drop-down" already dropped down

    1) Amazon style Drop-in content box-

    2) http://www.dynamicdrive.com/dynamici...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

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    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:

    Code:
    crossbox.style.top=0

  3. #3
    Join Date
    Jun 2008
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Quote Originally Posted by ddadmin View Post
    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:

    Code:
    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:

    Code:
    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...

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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...

  5. #5
    Join Date
    Jun 2008
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    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.

  6. #6
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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/...2/postit.shtml

  7. #7
    Join Date
    Jun 2008
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    That looks like the one. Thanks.

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
  •