Results 1 to 7 of 7

Thread: onclick instead of mouseover

  1. #1
    Join Date
    Jun 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default onclick instead of mouseover

    1) Script Title: Drop down/ Overlapping Content script

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

    3) Describe problem: onclick instead of mouseover

    Hi guys

    I've this script and would like to change the mouseover function to onclick, like this script: http://www.dynamicdrive.com/forums/s...ad.php?t=19528. I need the window opens through a click on the link and closes through a click on any part of the page. What should I do to get it?

    Thanks in advance

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

    Default

    Right now the script already supports revealing via onClick- see the second demo on the script page. Clicking on the anchor link again closes it.
    DD Admin

  3. #3
    Join Date
    Jun 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the answer

    However i had already seen the second demo and it's perfect. If there's a way to close the window through a click on the whole page, i would appreciate a ur help. Besides in the second demo, the window close onclick but on mouseover too, whereas i look for a window that close just with onclick.

    If there're other script here on Dynamicdrive that make this, let me know pls (i didn't found them yet).

    Many thanks!

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

    Default

    Besides in the second demo, the window close onclick but on mouseover too, whereas i look for a window that close just with onclick.
    Actually, you can disable that behavior with the script by default as well. Inside the .js file, set the value in red to false:

    Code:
     hidedivmouseout: [false, 200], //Set hiding behavior within Drop Down DIV itself: [hide_div_onmouseover?, miliseconds_before_hiding]
    That leaves hiding the Drop Down Content with the click of the mouse anywhere on the page, which is more complicated. If I have time I'll revisit this thread later this week. No promises.
    DD Admin

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

    Default

    Thank you for everything!!!!

    Code:
     hidedivmouseout: [false, 200], //Set hiding behavior within Drop Down DIV itself: [hide_div_onmouseover?, miliseconds_before_hiding]
    This works like a charm!!

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

    Default

    Hi

    I've a small problem about the code of this script.

    I moved this part

    HTML Code:
    <script type="text/javascript">
    //Call dropdowncontent.init("anchorID", "positionString", glideduration, "revealBehavior") at the end of the page:
    
    dropdowncontent.init("searchlink", "right-bottom", 500, "mouseover")
    dropdowncontent.init("contentlink", "left-top", 300, "click")
    
    </script>
    inside dropdowncontent.js, so:

    HTML Code:
    window.onload = function(){
    dropdowncontent.init("searchlink", "left-bottom", 500, "click");
    };
    It works very well in any page, but doesn't works in the pages which contain other scripts. What i can do to solve that?
    I would to leave just the html tags in the body and put any javascript in external files. Is it possible?

    Thanks in advance

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

    Default

    Try including a generic addEvent() function somewhere within your list of scripts loaded on the page. Such a function would look like:

    Code:
    function addEvent(target, functionref, tasktype){
    	if (target.addEventListener)
    		target.addEventListener(tasktype, functionref, false);
    	else if (target.attachEvent)
    		target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)});
    }
    Then, making sure the above function is defined in terms of source order before you make the following call, make a call such as:

    Code:
    addEvent(window, function(){
    	dropdowncontent.init("searchlink", "left-bottom", 500, "click")
    	}, "load")
    Untested, but this should work.
    DD Admin

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
  •