PDA

View Full Version : display drop down panel closed by every click on a internal link



marceldj
03-21-2010, 08:08 PM
1) Script Title: DD Drop Down Panel

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/dddropdownpanel.htm

3) Describe problem: Ive 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


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=/"
}

ddadmin
03-22-2010, 08:15 AM
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)?

marceldj
03-22-2010, 01:34 PM
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

ddadmin
03-22-2010, 07:33 PM
Sure, inside your configuration code, just turn off persistence of the panel state:


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?
})

tekneck
03-23-2010, 01:08 AM
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...


<script type="application/javascript">defaultpanel.togglepanelplus('down');</script>

What is the best way to control it's state when a page is loaded?

Thanks!

marceldj
03-24-2010, 01:52 PM
Dear Admin,

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

Thanks.

Marcel