Hey Yehuda,
.one('event',fn) has not been deprecated, as far as I know. Only the
individual .oneEvent(fn) methods have.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Mar 4, 2007, at 8:21 AM, Yehuda Katz wrote:
one has been deprecated since 1.1. For the same effect, you *might* be
able to do e.unbind() inside the event handler, as such:
$("#n").click(function(e) { e.unbind(); // code; return false; });
I'm not 100% that syntax made it in. That said, I don't think that's
what you're looking for. I think you want to bind a click on body, and
test to make sure that e.target is not the element in question.
$("#n").click(function(e) {
var self = this;
$("#menu").show();
$("body").click(function() {
if(e.target != self && e.target != $("#menu")[0]) $
("#menu").hide();
})
})
Something like the above has worked for me in the past (obviously with
more code to actually DO what you're trying to accomplish).
On 3/4/07, Klaus Hartl <[EMAIL PROTECTED]> wrote:
Philip Pryce schrieb:
Is there some way of making a bind function so that, one you
click away from
an element (say drop down menu) it disapears. So say i've clicked
a button
and a menus poped up, i then taken a look at the menu and i dont
need it
again, so i click on some other part of the page and the menu
hides it self
again. Any ideas?
Philip, there is the "one" function, that does exactly what you need.
$('#target').one('click', function() {
...
});
-- Klaus
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
--
Yehuda Katz
Web Developer | Wycats Designs
(ph) 718.877.1325
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/