|
|
Subject: [jQuery] Re: question re: .live() and .empty() - msg#02651
List: jQuery
The .live() method binds event handlers at a higher level than the
node(s) selected. So, in other words the events aren't actually bound
to specific nodes so they won't be removed when you call empty.
If you need to remove a live event, just call .die(). It is like
.unbind() but for .live() events.
http://docs.jquery.com/Events/die#typefn
--
Brandon Aaron
On Fri, May 29, 2009 at 10:06 PM, Jack Killpatrick <jack@xxxxxxxx> wrote:
>
> I'm guessing that once a .live() instantiation occurs it's there for good.
> If that's the case, is there a way to destroy it? (in particular as it
> pertains to a selector).
>
> I'm debating using it in a plugin, but am wary because of what could happen
> with multiple instances of the plugin and maybe no ability to destroy it
> completely.
>
> Thanks,
> Jack
>
> Jack Killpatrick wrote:
> >
> > Hi All,
> >
> > Wondering if someone knows the answer to this:
> >
> > Using jQuery 1.3.2, if some items inside a div have events bound to them
> > via .live() and then .empty() is called on the div will the events that were
> > bound via .live() get removed? The .empty() doc says:
> >
> > http://docs.jquery.com/Manipulation/empty
> >
> > Note that this function starting with 1.2.2 will also remove all event
> > handlers and internally cached data.
> >
> > But something I'm working on makes me think that the .live() events are
> > not removed. I haven't nailed it down yet.
> >
> > Thanks,
> > Jack
> >
> >
>
>
>
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
[jQuery] Re: animate scrollTop
I said $('html') is working... Please read more carefully...
What i need is a fix for this function becouse it is still being
animated for a small period of time, after it reach top. It seems that
if you have that anchor relativly close to the top, this bug have more
chance to show, and for instance if anchor is way down then it works
like it should... <_<
On May 30, 5:06 pm, waseem sabjee <waseemsab...@xxxxxxxxx> wrote:
> $('a.goToTop').click(function() {
> $(this).animate({scrollTop : 0},'slow');
> });
>
> OR
>
> $('a.goToTop').click( function() {
> $().animate({scrollTop : 0},'slow');
> });
>
> On Sat, May 30, 2009 at 4:55 PM, GaVrA <ga...@xxxxxxxxxxx> wrote:
>
> > If you mean just to remove html with body - that wont work... Already
> > tried it.
>
> > On May 30, 4:50 pm, waseem sabjee <waseemsab...@xxxxxxxxx> wrote:
> > > $('a.goToTop').click(function(
>
> > > > ) {
> > > > $('body').animate({scrollTop : 0},'slow');
> > > > });
> > > On Sat, May 30, 2009 at 4:29 PM, GaVrA <ga...@xxxxxxxxxxx> wrote:
>
> > > > Hi!
>
> > > > I am using this code:
>
> > > > $('a.goToTop').click(function() {
> > > > $('html').animate({scrollTop : 0},'slow');
> > > > });
>
> > > > And it works like it should. Problem is that sometimes it just bugs
> > > > out for short period of time, like when you click anchor and it
> > > > scroll's to top, if you then try to use scroll on mouse to scroll down
> > > > it just keep returning you to top... :(
>
> > > > And after that short period of time it stop's doing that.
>
> > > > Any idea how to fix this? Something like when it reach top to stop
> > > > working or something like that.
Next Message by Date:
click to view message preview
[jQuery] Re: question re: .live() and .empty()
Thanks, Brandon. So .empty() won't touch events that were bound using a
selector on objects inside what is being emptied, right? Gotta use
.die() to get rid of them?
- Jack
Brandon Aaron wrote:
The .live() method binds event handlers at a higher level than the
node(s) selected. So, in other words the events aren't actually bound
to specific nodes so they won't be removed when you call empty.
If you need to remove a live event, just call .die(). It is like
.unbind() but for .live() events.
http://docs.jquery.com/Events/die#typefn
--
Brandon Aaron
On Fri, May 29, 2009 at 10:06 PM, Jack Killpatrick <jack@xxxxxxxx> wrote:
I'm guessing that once a .live() instantiation occurs it's there for good.
If that's the case, is there a way to destroy it? (in particular as it
pertains to a selector).
I'm debating using it in a plugin, but am wary because of what could happen
with multiple instances of the plugin and maybe no ability to destroy it
completely.
Thanks,
Jack
Jack Killpatrick wrote:
Hi All,
Wondering if someone knows the answer to this:
Using jQuery 1.3.2, if some items inside a div have events bound to them
via .live() and then .empty() is called on the div will the events that were
bound via .live() get removed? The .empty() doc says:
http://docs.jquery.com/Manipulation/empty
Note that this function starting with 1.2.2 will also remove all event
handlers and internally cached data.
But something I'm working on makes me think that the .live() events are
not removed. I haven't nailed it down yet.
Thanks,
Jack
Previous Message by Thread:
click to view message preview
[jQuery] Re: question re: .live() and .empty()
I'm guessing that once a .live() instantiation occurs it's there for
good. If that's the case, is there a way to destroy it? (in particular
as it pertains to a selector).
I'm debating using it in a plugin, but am wary because of what could
happen with multiple instances of the plugin and maybe no ability to
destroy it completely.
Thanks,
Jack
Jack Killpatrick wrote:
Hi All,
Wondering if someone knows the answer to this:
Using jQuery 1.3.2, if some items inside a div have events bound to
them via .live() and then .empty() is called on the div will the
events that were bound via .live() get removed? The .empty() doc says:
http://docs.jquery.com/Manipulation/empty
Note that this function starting with 1.2.2 will also remove all event
handlers and internally cached data.
But something I'm working on makes me think that the .live() events
are not removed. I haven't nailed it down yet.
Thanks,
Jack
Next Message by Thread:
click to view message preview
[jQuery] Re: question re: .live() and .empty()
Thanks, Brandon. So .empty() won't touch events that were bound using a
selector on objects inside what is being emptied, right? Gotta use
.die() to get rid of them?
- Jack
Brandon Aaron wrote:
The .live() method binds event handlers at a higher level than the
node(s) selected. So, in other words the events aren't actually bound
to specific nodes so they won't be removed when you call empty.
If you need to remove a live event, just call .die(). It is like
.unbind() but for .live() events.
http://docs.jquery.com/Events/die#typefn
--
Brandon Aaron
On Fri, May 29, 2009 at 10:06 PM, Jack Killpatrick <jack@xxxxxxxx> wrote:
I'm guessing that once a .live() instantiation occurs it's there for good.
If that's the case, is there a way to destroy it? (in particular as it
pertains to a selector).
I'm debating using it in a plugin, but am wary because of what could happen
with multiple instances of the plugin and maybe no ability to destroy it
completely.
Thanks,
Jack
Jack Killpatrick wrote:
Hi All,
Wondering if someone knows the answer to this:
Using jQuery 1.3.2, if some items inside a div have events bound to them
via .live() and then .empty() is called on the div will the events that were
bound via .live() get removed? The .empty() doc says:
http://docs.jquery.com/Manipulation/empty
Note that this function starting with 1.2.2 will also remove all event
handlers and internally cached data.
But something I'm working on makes me think that the .live() events are
not removed. I haven't nailed it down yet.
Thanks,
Jack
|
|