View Full Version : onclick instead of mouseover
1) Script Title: Drop down/ Overlapping Content script
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex5/overlapcontent.htm
3) Describe problem: onclick instead of mouseover
Hi guys :)
I've this script (http://www.dynamicdrive.com/dynamicindex5/overlapcontent.htm) and would like to change the mouseover function to onclick, like this script: http://www.dynamicdrive.com/forums/showthread.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
ddadmin
11-25-2008, 07:19 AM
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.
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!
ddadmin
11-26-2008, 07:27 AM
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:
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. :)
Thank you for everything!!!! :D
hidedivmouseout: [false, 200], //Set hiding behavior within Drop Down DIV itself: [hide_div_onmouseover?, miliseconds_before_hiding]
This works like a charm!!
Hi
I've a small problem about the code of this script.
I moved this part
<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:
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
ddadmin
12-02-2008, 02:10 AM
Try including a generic addEvent() function somewhere within your list of scripts loaded on the page. Such a function would look like:
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:
addEvent(window, function(){
dropdowncontent.init("searchlink", "left-bottom", 500, "click")
}, "load")
Untested, but this should work.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.