PDA

View Full Version : Drop Down/ Overlapping Content - Close Div Upon Opening Another



So_Cute
08-22-2008, 01:03 PM
1) Script Title: Drop Down/ Overlapping Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex5/overlapcontent.htm

3) Describe problem: I have this script applied to a vertical list of links. I have the "revealbehavior" set to "click" and a link inside the div to close it. Everything is working beautifully with one small exception. More than one div can be open at a time. I would like to modify the script so that when a div is opened by clicking another link, any previously opened divs are closed.

I found this thread: http://www.dynamicdrive.com/forums/showthread.php?t=26532&highlight=Overlapping+Content
which addresses my need, but the script seems to have been updated since the date of that thread. I cannot figure out what modifications need to be made to the current script to produce the behavior I want.

Please help. Thanks.

ddadmin
08-22-2008, 05:48 PM
Sure, try finding the below lines inside the .js file, and adding to it the code in red:


if (!this.isContained(anchorobj, e)){
var e=window.event || e
if (e.type=="click" && subobj.style.visibility=="visible"){
subobj.style.visibility="hidden"
return
}
if (typeof lastoverlayobj!="undefined" && lastoverlayobj!=subobj){
lastoverlayobj.style.visibility="hidden"
}
lastoverlayobj=subobj

So_Cute
08-22-2008, 11:51 PM
Perfect! You are AWESOME! Thank you for all of your time and efforts you give to the web developer community!

newyorker2
12-15-2008, 05:37 PM
Sure, try finding the below lines inside the .js file, and adding to it the code in red:


if (!this.isContained(anchorobj, e)){
var e=window.event || e
if (e.type=="click" && subobj.style.visibility=="visible"){
subobj.style.visibility="hidden"
return
}
if (typeof lastoverlayobj!="undefined" && lastoverlayobj!=subobj){
lastoverlayobj.style.visibility="hidden"
}
lastoverlayobj=subobj


this makes the script not working on safari,
any ideas what may be breaking it on safari?

thank you

newyorker2
12-15-2008, 06:09 PM
this makes the script not working on safari,
any ideas what may be breaking it on safari?

thank you

my bad. it wasn't your code breaking the safari :)

newyorker2
12-17-2008, 08:30 PM
Sure, try finding the below lines inside the .js file, and adding to it the code in red:


if (!this.isContained(anchorobj, e)){
var e=window.event || e
if (e.type=="click" && subobj.style.visibility=="visible"){
subobj.style.visibility="hidden"
return
}
if (typeof lastoverlayobj!="undefined" && lastoverlayobj!=subobj){
lastoverlayobj.style.visibility="hidden"
}
lastoverlayobj=subobj

hi,

after implementing this, overlapping div does not hide itself after mouse out. (safari only)
any ideas what may be causing this?

newyorker2
12-18-2008, 02:37 PM
hi,

after implementing this, overlapping div does not hide itself after mouse out. (safari only)
any ideas what may be causing this?

any help is really appreciated

ddadmin
12-19-2008, 01:08 AM
I just tested the modified script in Safari 3.x (win), and it works as intended. What version of Safari are you using? Also, inside the script, make sure the following variable is set to true:


var dropdowncontent={
disableanchorlink: true, //when user clicks on anchor link, should link itself be disabled (always true if "revealbehavior" above set to "click")
hidedivmouseout: [true, 200], //Set hiding behavior within Drop Down DIV itself: [hide_div_onmouseover?, miliseconds_before_hiding]