Results 1 to 8 of 8

Thread: Drop Down/ Overlapping Content - Close Div Upon Opening Another

  1. #1
    Join Date
    Jan 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Drop Down/ Overlapping Content - Close Div Upon Opening Another

    1) Script Title: Drop Down/ Overlapping Content

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...lapcontent.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/s...apping+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.

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

    Default

    Sure, try finding the below lines inside the .js file, and adding to it the code in red:

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

  3. #3
    Join Date
    Jan 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Perfect! You are AWESOME! Thank you for all of your time and efforts you give to the web developer community!

  4. #4
    Join Date
    Jun 2008
    Posts
    40
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    Sure, try finding the below lines inside the .js file, and adding to it the code in red:

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

  5. #5
    Join Date
    Jun 2008
    Posts
    40
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

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

  6. #6
    Join Date
    Jun 2008
    Posts
    40
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin View Post
    Sure, try finding the below lines inside the .js file, and adding to it the code in red:

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

  7. #7
    Join Date
    Jun 2008
    Posts
    40
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

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

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

    Default

    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:

    Code:
    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]
    DD Admin

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

    newyorker2 (12-19-2008)

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
  •