Results 1 to 6 of 6

Thread: display drop down panel closed by every click on a internal link

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

    Default display drop down panel closed by every click on a internal link

    1) Script Title: DD Drop Down Panel

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...pdownpanel.htm

    3) Describe problem: I´ve created on my website a dropdown panel at the top. When I toggle open the panel and then click on a link the following happens: The panel is displayed open.

    My question is: Is it possible to display the panel closed by every click on a internal link?

    I have tried to hide the "set cookie" function

    Code:
    ddpanel.getCookie=function(Name){ 
    	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
    	if (document.cookie.match(re)) //if cookie found
    		return document.cookie.match(re)[0].split("=")[1] //return its value
    	return null
    }
    
    ddpanel.setCookie=function(name, value){
    	document.cookie = name+"=" + value + ";path=/"
    }
    Last edited by marceldj; 03-21-2010 at 08:09 PM. Reason: forgot a word

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

    Default

    Are you asking how to have the Drop Down Panel close immediately when a link inside it is clicked on (hence that closed state is then remembered and persisted)?
    DD Admin

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

    Default

    I'm asking if it is possible that the DD-panel can be displayed closed after a click on an internal link within the site ( It doesn't matter which link ). After every refresh of the page the panel's state need to be closed.

    I hope that this post clearify something for you.

    Many thanks

    Marcel

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

    Default

    Sure, inside your configuration code, just turn off persistence of the panel state:

    Code:
    var defaultpanel=new ddpanel({
    ids: ["mypanel", "mypanelcontent", "mypaneltab"], // id of main panel DIV, content DIV, and tab DIV
    stateconfig: {initial: "5px", persiststate: false}, // 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

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

    marceldj (03-24-2010)

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

    Default What About Initially Open on home page and collapsed on others?

    Not meaning to hijack this thread, but this may be relevant to others readinb this post.

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

    How can I tell the panel to be open on the home page?

    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!

  7. #6
    Join Date
    Mar 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Dear Admin,

    This is answer I was looking for. So this thread has been solved.

    Thanks.

    Marcel

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
  •