tag:blogger.com,1999:blog-8640596986273216089.post4697313555387045783..comments2023-08-15T06:10:51.086-03:00Comments on Ariel Flesler: jQuery.ListenAriel Fleslerhttp://www.blogger.com/profile/17700414222186772120noreply@blogger.comBlogger72125tag:blogger.com,1999:blog-8640596986273216089.post-52354331904788747152010-10-28T11:47:29.118-03:002010-10-28T11:47:29.118-03:00Following on from my previous post, I've tried...Following on from my previous post, I've tried the following code:<br /><br />$('#pagination div a').each(function(i,item){<br /> $(this).listen('click','a',function(){<br /> var offsetNo = $(this).attr('href').replace('http://www.mysite.com/news?&', '');<br /> $('#results').load('results.php?'+offsetNo, function() {<br /> //call back if needed<br /> });<br /> return false;<br /> });<br />});<br /><br />This appears to be the correct syntax, but only works once. Once the ajax load has fired, the event handlers are still unbound. I thought this plugin took care of this or am I doing something wrong?Unknownhttps://www.blogger.com/profile/06937619357594365305noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-20773494099572893422010-10-28T11:18:14.394-03:002010-10-28T11:18:14.394-03:00This plugin looks fantastic - exactly what I need....This plugin looks fantastic - exactly what I need.<br /><br />However I'm struggling to change my code to the correct syntax and wondered if someone could help?<br /><br />My page is basically a results page with pagination. The page number links appear in a div called 'pagination' and the results appear in a div called 'results'.<br /><br />I use JQuery to cycle through each href anchor in the pagination div and attach an onclick event handler to each. Clicking on an anchor in the pagination fires an ajax load to update the results.<br /><br />Here is my code:<br /><br />$('#pagination div a').each(function(i,item){<br /> $(this).click(function(){<br /> var offsetNo = $(this).attr('href').replace('http://www.mysite.com/news?&', '');<br /> $('#results').load('results.php?'+offsetNo, function() {<br /> //call back if needed<br /> });<br /> return false;<br /> });<br />});<br /><br />How can I modify the code to work with the plugin?<br /><br />Hope you can help?<br />Many thanksUnknownhttps://www.blogger.com/profile/06937619357594365305noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-28424814586393852072009-12-11T20:30:20.599-03:002009-12-11T20:30:20.599-03:00Hi sheepfunk
That's not what jQuery Listen is ...Hi sheepfunk<br />That's not what jQuery Listen is used for, sorry.Ariel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-19833183926191115842009-12-11T19:42:21.286-03:002009-12-11T19:42:21.286-03:00How would I catch and rewrite an inline onclick wi...How would I catch and rewrite an inline onclick with jQuery listen? I'm trying to find all onclicks of elements with a given class, and wrap them in a jConfirm dialogue. I'm having issues with pages where I'm rewriting portions of the page with Ajax, so how would I use jQuery listen to catch the onclicks of my elements and rewrite them on the fly.sheepfunkhttps://www.blogger.com/profile/02328734662305004890noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-16910975833309465932009-05-26T10:24:30.047-03:002009-05-26T10:24:30.047-03:00Hi Ed
I don't know the plugin so w/o a demo, I rea...Hi Ed<br />I don't know the plugin so w/o a demo, I really don't understand.<br />I think you should consult the author of the code bubbles plugin.Ariel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-83293611324505769332009-05-21T14:26:29.992-03:002009-05-21T14:26:29.992-03:00Hi Ariel,
This looks like the solution I need, bu...Hi Ariel,<br /><br />This looks like the solution I need, but I don't know how to implement it for my issue. I am using a plug-in I found online (see http://jqueryfordesigners.com/coda-popup-bubbles/) which shows a "pop-up" image/div etc. when you hover over a link, but I am using this INSIDE is div which is updated via AJAX. Once the div is updated via AJAX, this plug-in doesn't work. Is there a way to use jQuery.Listen to resolve this? I don't know if you can help because I know this also relates to a separate plug-in, but as your plug-in could be the solution I thought I'd ask! I hope you can help, thank you.Ednoreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-30825130863570817592009-04-16T10:33:00.000-03:002009-04-16T10:33:00.000-03:00@Fred
Dunno anything about ColorBox. You should pr...@Fred<br />Dunno anything about ColorBox. You should probably consult the plugin's owner. Listen is merely a binding plugin.<br /><br />@Martin<br />The idea is that the context you use for listen() (that is $('li.activityLink') in your case) is not going to be destroyed.<br /><br />You should rather use:<br />$('ul').listen('click','a',function(){<br />if(!$(this).parents().is('li.activityLink'))<br /> return;<br /><br />// Do stuff<br />});<br /><br />That is, if the UL's aren't replaced.Ariel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-51913884563707824062009-04-15T08:45:00.000-03:002009-04-15T08:45:00.000-03:00Hi there,
This is a great little plug in BTW, I h...Hi there,<br /><br />This is a great little plug in BTW, I heard about it at the AJAX @media conference last year.<br /><br />There's one small issue I've found, is that I can't listen for an 'li' with a class, then check the a tags within it, any idea why this might be?<br /><br />$('li.activityLink').listen('click','a',function(item){<br />alert('I can't get to this');<br />});<br /><br />$('li') works fine, but not when I add a class.<br /><br />This has occurred because I am populating the ul with the li's, via AJAX.Martin Edwardshttp://www.cogapp.comnoreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-34816746296768029522009-03-31T16:58:00.000-03:002009-03-31T16:58:00.000-03:00Hi!I want to use listen with Colorbox (http://colo...Hi!<BR/>I want to use listen with Colorbox (http://colorpowered.com/colorbox/) but I can't get it running.<BR/>I use Colorbox for example like<BR/>$("a.showbox").colorbox();<BR/>I tried this (and a few other ways):<BR/>$.listen("click", "a.showbox", function(){<BR/> $(this).colorbox();<BR/>});<BR/>But it does not work for me.<BR/>Can you figure out a way to get this working?<BR/>Thx!<BR/>FredFrednoreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-40622156691094688512008-12-29T10:12:00.000-02:002008-12-29T10:12:00.000-02:00Right, will have this in mind for a future release...Right, will have this in mind for a future release. Thanks.Ariel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-2620242612145846972008-12-24T20:21:00.000-02:002008-12-24T20:21:00.000-02:00Hi! I would recommend that node.nodeName is conver...Hi! I would recommend that node.nodeName is converted to uppercase for plugin to work on XHTML(application/xhtml+xml) pages.<BR/><BR/>Thanks for great plugin!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-61805717631595299302008-11-25T09:07:00.000-02:002008-11-25T09:07:00.000-02:00That's done to avoid memory leaks. Same as jQuery'...That's done to avoid memory leaks. Same as jQuery's core does. The idea is not to keep references to DOM nodes else they might not be garbage collected.<BR/><BR/>CheersAriel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-27941055017669133372008-11-25T08:52:00.000-02:002008-11-25T08:52:00.000-02:00I noticed you are doing a bit of clean up when the...I noticed you are doing a bit of clean up when the window unloads. Why is that? Could you explain this or post a link that does?<BR/><BR/>ThanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-83974115525423283612008-10-27T21:28:00.000-02:002008-10-27T21:28:00.000-02:00Very nice. Thank you for the quick response!Very nice. Thank you for the quick response!Unknownhttps://www.blogger.com/profile/18245180233652589943noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-88364996814534346782008-10-27T21:09:00.000-02:002008-10-27T21:09:00.000-02:00That's not related to the plugin. The click event ...That's not related to the plugin. The click event is triggered for any button, if you want to filter clicks on other buttons than the left one, you need to do something like this:<BR/><BR/>$.listen('click','#a', function(e){<BR/> if( e.button != 0 )<BR/> return;<BR/> // the code<BR/>});<BR/><BR/>More <A HREF="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MouseEvent" REL="nofollow">here</A>.<BR/><BR/>http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MouseEventAriel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-10439766025340182552008-10-27T20:39:00.000-02:002008-10-27T20:39:00.000-02:00This is an incredible plug in! Thank you so much ...This is an incredible plug in! Thank you so much for putting the time in. <BR/><BR/>Everything works great for me except that when I listen for the 'click' event it grabs right click events as well. This is a pain if your are trying to grab pics off the site. Is there a way to avoid this?<BR/><BR/>ThanksUnknownhttps://www.blogger.com/profile/18245180233652589943noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-60965815762125213582008-09-09T13:58:00.000-03:002008-09-09T13:58:00.000-03:00You're not passing the function, you're calling it...You're not passing the function, you're calling it in-place.<BR/>Check some js tutorials so you get this clear.<BR/><BR/>About the 2nd argument, it's a filter, to read more, check the docs on this blog post.Ariel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-9827788059686571752008-09-09T12:36:00.000-03:002008-09-09T12:36:00.000-03:00This comment has been removed by the author.Frédéric Fournaisehttps://www.blogger.com/profile/12758462177425208636noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-7648132976139018162008-08-07T15:36:00.000-03:002008-08-07T15:36:00.000-03:00HiYou use classes for different sets of links. You...Hi<BR/><BR/>You use classes for different sets of links. <BR/>You can either bind each set of links with a different handler, or check the classes and work accordingly inside one single handler.<BR/><BR/>What you're trying to do by calling listen on #special is that only the links inside #special will get thru that handler2.<BR/><BR/>You can avoid getting handler1 triggered by calling:<BR/><BR/>e.stopPropagation();<BR/><BR/>inside handler2, assuming that e is the name of the event object received by the function.<BR/><BR/>CheersAriel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-4433210949283220162008-08-07T15:06:00.000-03:002008-08-07T15:06:00.000-03:00Hi and thanks for this essential plugin. I have$....Hi and thanks for this essential plugin. I have<BR/><BR/>$.listen('click','a',handler1)<BR/><BR/>as a general handler for anchors. I also have (would like to have!)<BR/><BR/>$('#special').listen('click','a',handler2)<BR/><BR/>to handle known special cases separately. But it seems only handler1 is executed and handler2 never gets called. Is this the expected behavior or am I doing something wrong. Thanks.amirhttps://www.blogger.com/profile/13445444925766070474noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-73921494308861721252008-07-31T10:37:00.000-03:002008-07-31T10:37:00.000-03:00HiOk, I'll have it in mind.Thanks :)Hi<BR/><BR/>Ok, I'll have it in mind.<BR/>Thanks :)Ariel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-38710779956455264662008-07-31T03:52:00.000-03:002008-07-31T03:52:00.000-03:00Hello Ariel,i'm fine with my workaround, if i woul...Hello Ariel,<BR/><BR/>i'm fine with my workaround, if i would change your sources, i would have to do this in every new version and I don't want to ;-)<BR/><BR/>I understand you can't change this anymore, because this would break somebody else code, but you could mention it in the documentation or give this function a parameter for this.<BR/><BR/>However, that just my two cents and not really important.<BR/><BR/>regards,<BR/>TimTim Büthehttps://www.blogger.com/profile/10237607035709620470noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-33337337106826401272008-07-30T10:16:00.000-03:002008-07-30T10:16:00.000-03:00Hi TimGood point, it's a valid situation (not TOO ...Hi Tim<BR/><BR/>Good point, it's a valid situation (not TOO frequent but valid).<BR/><BR/>I really tried to keep perfomance as high as possible.<BR/>So you'd rather patch it for yourself if you want (no one complained before).<BR/><BR/>In line 154, replace:<BR/><I>each( handlers,</I><BR/>for<BR/><I>each( $.unique(handlers),</I><BR/><BR/>CheersAriel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-30709090740099619942008-07-30T10:03:00.000-03:002008-07-30T10:03:00.000-03:00First of all, thank you for the plugin, it's p...First of all, thank you for the plugin, it's pretty handy.<BR/><BR/>One thing I stumbled upon is the following. If you use CSS classes in the selector and you have an element that got for example two classes, that are both in the selector, the given function gets called twice. This maybe reasonable, but in my humble opinon not what one would expect. I worked around this by listening to focus and do an addClass and listening to blur and do an removeClass instead of listening to both and do a toggle. However, just want to let you and your readers know, if you don't do already. Maybe you could note this in the documentation...? <BR/><BR/>keep up the good work,<BR/>Tim Büthe<BR/><BR/>PS: here is an small example:<BR/><BR/><html><BR/> <head><BR/> <script src="js/jquery-1.2.6.min.js" type="text/javascript"></script><BR/> <script src="js/jquery.listen-1.0.3-min.js" type="text/javascript"></script><BR/> <BR/> <style><BR/> <BR/> .style1 {<BR/> background-color: silver;<BR/> }<BR/> <BR/> .style2 {<BR/> color: blue;<BR/> }<BR/> <BR/> .focused {<BR/> background-color: yellow;<BR/> }<BR/> <BR/> </style><BR/> <BR/> <script type="text/javascript"><BR/> $(document).ready(function(){<BR/> $('body').listen('focus blur', 'input.style1, input.style2', function(){<BR/> $(this).toggleClass('focused')<BR/> });<BR/> });<BR/> </script><BR/> <BR/> <BR/> </head><BR/> <BR/> <body><BR/> <input type="text" class="style1" value="test"/><BR/> <input type="text" class="style2" value="test"/><BR/> <input type="text" class="style1 style2" value="test"/><BR/> </body><BR/></html>Tim Büthehttps://www.blogger.com/profile/10237607035709620470noreply@blogger.comtag:blogger.com,1999:blog-8640596986273216089.post-7577127250109983282008-07-16T13:06:00.000-03:002008-07-16T13:06:00.000-03:00It's not a matter of Listen or Intercept.the 'chan...It's not a matter of Listen or Intercept.<BR/>the 'change' event can't be handled using event delegation on IE.Ariel Fleslerhttps://www.blogger.com/profile/17700414222186772120noreply@blogger.com