Results 1 to 7 of 7

Thread: Drop Down Panel: How To Control State On Each Page?

  1. #1
    Join Date
    Mar 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Drop Down Panel: How To Control State On Each Page?

    I need to have my panel open by default on my home page and then allow visitors to open and close it (with persistence) after that...

    http://www.dynamicdrive.com/dynamici...pdownpanel.htm

    How can I tell the panel to be open on the home page? And initially closed on others initially until the user closes it?

    Adding the code below to my page, either above or below the panel code does not seem to make a difference...


    Code:
    <script type="application/javascript">defaultpanel.togglepanelplus('down');</script>
    What is the best way to control it's state when a page is loaded?

    Thanks!

  2. #2
    Join Date
    Feb 2005
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I would also like a solution to this as well, it would be useful to be able to define the state of windows when the page loads.

    Any ideas?

  3. #3
    Join Date
    Aug 2004
    Posts
    9,890
    Thanks
    3
    Thanked 964 Times in 953 Posts
    Blog Entries
    15

    Default

    Try the below modified .js file. With it, to get the Drop Down Panel on a specific page to be opened by default, edit its configuration code by adding the part in red:

    Code:
    var defaultpanel=new ddpanel({
    	ids: ["mypanel", "mypanelcontent", "mypaneltab"], // id of main panel DIV, content DIV, and tab DIV
    	stateconfig: {initial: "5px", persiststate: true, initialstate:"open"}, // initial: initial reveal amount in pixels (ie: 5px)
    	animate: {enabled: true, steps: 5}, //steps: number of animation steps. Int between 1-20. Smaller=faster.
    	pointerimage: {enabled: true, src: ["arrow-down.gif", "arrow-up.gif"]},
    	closepanelonclick: {enabled: true} // close panel when links or elements with CSS class="closepanel" within container is clicked on?
    })
    DD Admin

  4. The Following User Says Thank You to ddadmin For This Useful Post:

    Code Red (03-30-2010)

  5. #4
    Join Date
    Feb 2005
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Brilliant! Thanks so much for this.

  6. #5
    Join Date
    Feb 2005
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Whoops... spoke a little too soon - the initial panel state works initially, but from then onwards it toggles between the open and closed state each time the page is refreshed.

    If I set persiststate to false the panel remains open all the time, but that's not how I'd like it to work really - I'd like the panel to be open as a default when the site opens, but if the visitor then closes that panel I'd like it to stay closed.

    Sorry to be picky!

  7. #6
    Join Date
    Aug 2004
    Posts
    9,890
    Thanks
    3
    Thanked 964 Times in 953 Posts
    Blog Entries
    15

    Default

    You're right, there are some bugs in that version. Try the below one instead...
    DD Admin

  8. The Following User Says Thank You to ddadmin For This Useful Post:

    Code Red (03-31-2010)

  9. #7
    Join Date
    Feb 2005
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Much better, thanks again!

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
  •