I am trying to build my own select pull down menu that will close when
a click is observed outside of the pull down div, but I am having
trouble stopping the click event from triggering when the link to show
the pull down is clicked. This is the relevant code:
<a onclick="showSelect();" id="start_time">Open Div</a>
function showSelect() {
if($('dropdown').style.visibility == "visible") {
$('dropdown').style.visibility = "hidden";
Event.stopObserving(document.body, 'click', new_obj.bfx);
} else {
new_obj.bfx = new_obj.fx.bindAsEventListener(new_obj);
$('dropdown').style.visibility = "visible";
Event.observe(document.body, 'click', new_obj.bfx);
//!!this click event is triggered right away when the link with
id="start_time" is
//clicked. I would like to remove this specific event somehow
}
}
//this function is suppossed to close the div the page is clicked
anywhere but on the div
var new_obj = { fx: function(){
$('dropdown').style.visibility = "hidden";
}}
I would really appreciate any help or suggestions, I am pretty new to
prototype and this has me completely stumped. Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---