[jQuery] Re: fadeOut Callback Trigger Count
Thanks very much. On Apr 20, 2:19 am, Karl Swedberg wrote: > You could do something like this: > > $(document).ready(function() { > $("#menu ul li a").click(function(e) { > e.preventDefault(); > var $sibs = $(this).parent().siblings(); > $sibs.fadeOut(function() { > if ( $sibs.index(this) == $sibs.length-1 ) { > $("p").append("Executed. "); > } > }); > }); > $("p").append("Page loaded. "); > > }); > > This will only append "Executed." for the last sibling in the group. > ($sibs.index(this) == $sibs.length-1). > > --Karl > > > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Apr 19, 2009, at 6:01 PM, blockedmind wrote: > > > > > Thanks for the reply firstly. :) Since I'm talking about a default > > jQuery function I didn't give a full example. If you think that I'd > > help let me give you one. > > > I have simplified my code for the example, here it goes: > >http://blockedmind.com/jq/fadeout.html > > > When you click a link, the others are disappearing and a message is > > added to the testing paragraf. I want to get "Executed" text added > > once. But it is added as many as the count of siblings due to default > > options of fadeOut callback function. > > > And no, I can not put it elsewhere because I have more effects after > > click in my real situation and I need to get that message after all of > > them completed and for once of course. > > > I hope I am clear? > > > On Apr 19, 4:44 pm, Karl Swedberg wrote: > >> Would you mind giving us some code to look at? Or point us to a test > >> page? It might be easier to help you if we have something to look at. > > >> --Karl > > >> > >> Karl Swedbergwww.englishrules.comwww.learningjquery.com > > >> On Apr 19, 2009, at 7:22 AM, blockedmind wrote: > > >>> Hmmm... > > >>> On Apr 18, 2:28 am, blockedmind wrote: > >>>> Nothing? > > >>>> On Apr 17, 8:46 pm, blockedmind wrote: > > >>>>> This problem occurs when $("#menu li a").fadeOut(function() {}); > >>>>> being > >>>>> used. callback function is called 3 times 'cos there is 3 li > >>>>> elements. > > >>>>> On Apr 17, 7:28 pm, blockedmind wrote: > > >>>>>> Callback function of fadeOut effect is executed once for each > >>>>>> element > >>>>>> animated against. Is it possible to make it executed once after > >>>>>> all > >>>>>> elements faded?
[jQuery] Re: fadeOut Callback Trigger Count
Thanks for the reply firstly. :) Since I'm talking about a default jQuery function I didn't give a full example. If you think that I'd help let me give you one. I have simplified my code for the example, here it goes: http://blockedmind.com/jq/fadeout.html When you click a link, the others are disappearing and a message is added to the testing paragraf. I want to get "Executed" text added once. But it is added as many as the count of siblings due to default options of fadeOut callback function. And no, I can not put it elsewhere because I have more effects after click in my real situation and I need to get that message after all of them completed and for once of course. I hope I am clear? On Apr 19, 4:44 pm, Karl Swedberg wrote: > Would you mind giving us some code to look at? Or point us to a test > page? It might be easier to help you if we have something to look at. > > --Karl > > > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Apr 19, 2009, at 7:22 AM, blockedmind wrote: > > > > > Hmmm... > > > On Apr 18, 2:28 am, blockedmind wrote: > >> Nothing? > > >> On Apr 17, 8:46 pm, blockedmind wrote: > > >>> This problem occurs when $("#menu li a").fadeOut(function() {}); > >>> being > >>> used. callback function is called 3 times 'cos there is 3 li > >>> elements. > > >>> On Apr 17, 7:28 pm, blockedmind wrote: > > >>>> Callback function of fadeOut effect is executed once for each > >>>> element > >>>> animated against. Is it possible to make it executed once after all > >>>> elements faded?
[jQuery] Re: fadeOut Callback Trigger Count
Hmmm... On Apr 18, 2:28 am, blockedmind wrote: > Nothing? > > On Apr 17, 8:46 pm, blockedmind wrote: > > > This problem occurs when $("#menu li a").fadeOut(function() {}); being > > used. callback function is called 3 times 'cos there is 3 li elements. > > > On Apr 17, 7:28 pm, blockedmind wrote: > > > > Callback function of fadeOut effect is executed once for each element > > > animated against. Is it possible to make it executed once after all > > > elements faded?
[jQuery] Re: fadeOut Callback Trigger Count
Nothing? On Apr 17, 8:46 pm, blockedmind wrote: > This problem occurs when $("#menu li a").fadeOut(function() {}); being > used. callback function is called 3 times 'cos there is 3 li elements. > > On Apr 17, 7:28 pm, blockedmind wrote: > > > Callback function of fadeOut effect is executed once for each element > > animated against. Is it possible to make it executed once after all > > elements faded?
[jQuery] Re: fadeOut Callback Trigger Count
This problem occurs when $("#menu li a").fadeOut(function() {}); being used. callback function is called 3 times 'cos there is 3 li elements. On Apr 17, 7:28 pm, blockedmind wrote: > Callback function of fadeOut effect is executed once for each element > animated against. Is it possible to make it executed once after all > elements faded?
[jQuery] fadeOut Callback Trigger Count
Callback function of fadeOut effect is executed once for each element animated against. Is it possible to make it executed once after all elements faded?
[jQuery] Re: Looping JSON Data
well, i tried some options more... it turns out when i set ajax data type to "text" and convert it to json object using json.parser() it works just fine. ok then its solved but i should be able to pass data as a json object between two functions, right? On Jan 23, 4:24 pm, blockedmind wrote: > it returns > uncaught exception TypeError: Cannot read property 'length' of > undefined > error on google chrome's javascript debug window. > > let me put here the full scenario: > > var listsData=""; > function getLists() { > $.ajax({ > type: "POST", > url: "actions.php", > data: "action=managelists", > success: function(returnedLists){ > listsData = returnedLists; > printLists("ID","ASC"); > } > });} > > function printLists(sortBy,sortOption) { > //$('#listlist .listdata').html(listsData); > listsData=listsData['list']; > $.each(listsData,function (a,b,c) { > alert (b.id + ',' + b.name); > }); > > } > > so getList() function can successfully get the data i have wrote in > the first message. it is assigned to listsData and also passed > successfully to printLists function. > can it be the reason that i do not use dataType: "json" in the > getLists function? or what else? it seems so correct but it doesnt > work. :/ > > On Jan 22, 7:18 am, seasoup wrote: > > > or... > > > $.each(theList.list,function (a,b) { > > alert (b.id + ',' + b.name); > > > }) > > > On Jan 21, 7:30 pm, Ami wrote: > > > > I think that this what R U searching for: > > > > var theList={"list":[ > > > {"id":"15","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"}, > > > {"id":"16","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"}, > > > {"id":"17","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"} > > > ]}; > > > > theList=theList['list']; > > > $.each(theList,function (a,b,c) > > > { > > > alert (b.id + ',' + b.name); > > > > }) > > > > On Jan 22, 4:46 am, blockedmind wrote: > > > > > I have data recieved by ajax function of jquery like: > > > > {"list":[ > > > > {"id":"17","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"}, > > > > {"id":"16","name":"Another > > > > List","description":"Another","owner":"1","active":"1","featured":"0","machinename":"another- > > > > list"}, > > > > {"id":"15","name":"Listenin > > > > Adı","description":"Yeah.","owner":"1","active":"1","featured":"0","machinename":"listenin- > > > > adi"}, > > > > ]}; > > > > > how can i print each "list" in aloop? i tried many variations, > > > > couldn't get the result.
[jQuery] Re: Looping JSON Data
it returns uncaught exception TypeError: Cannot read property 'length' of undefined error on google chrome's javascript debug window. let me put here the full scenario: var listsData=""; function getLists() { $.ajax({ type: "POST", url: "actions.php", data: "action=managelists", success: function(returnedLists){ listsData = returnedLists; printLists("ID","ASC"); } }); } function printLists(sortBy,sortOption) { //$('#listlist .listdata').html(listsData); listsData=listsData['list']; $.each(listsData,function (a,b,c) { alert (b.id + ',' + b.name); }); } so getList() function can successfully get the data i have wrote in the first message. it is assigned to listsData and also passed successfully to printLists function. can it be the reason that i do not use dataType: "json" in the getLists function? or what else? it seems so correct but it doesnt work. :/ On Jan 22, 7:18 am, seasoup wrote: > or... > > $.each(theList.list,function (a,b) { > alert (b.id + ',' + b.name); > > }) > > On Jan 21, 7:30 pm, Ami wrote: > > > I think that this what R U searching for: > > > var theList={"list":[ > > {"id":"15","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"}, > > {"id":"16","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"}, > > {"id":"17","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"} > > ]}; > > > theList=theList['list']; > > $.each(theList,function (a,b,c) > > { > > alert (b.id + ',' + b.name); > > > }) > > > On Jan 22, 4:46 am, blockedmind wrote: > > > > I have data recieved by ajax function of jquery like: > > > {"list":[ > > > {"id":"17","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"}, > > > {"id":"16","name":"Another > > > List","description":"Another","owner":"1","active":"1","featured":"0","machinename":"another- > > > list"}, > > > {"id":"15","name":"Listenin > > > Adı","description":"Yeah.","owner":"1","active":"1","featured":"0","machinename":"listenin- > > > adi"}, > > > ]}; > > > > how can i print each "list" in aloop? i tried many variations, > > > couldn't get the result.
[jQuery] Looping JSON Data
I have data recieved by ajax function of jquery like: {"list":[ {"id":"17","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"}, {"id":"16","name":"Another List","description":"Another","owner":"1","active":"1","featured":"0","machinename":"another- list"}, {"id":"15","name":"Listenin Adı","description":"Yeah.","owner":"1","active":"1","featured":"0","machinename":"listenin- adi"}, ]}; how can i print each "list" in a loop? i tried many variations, couldn't get the result.
[jQuery] Re: Case Insentitive Selectorys
So whan can I use to find attribute instead of a.textContent|| a.innerText||jQuery(a).text() ? On Sep 23, 6:49 pm, Eric Martin <[EMAIL PROTECTED]> wrote: > I recently posted about a custom jQuery selector to do a case- > insensitive exact > search:http://www.ericmmartin.com/creating-a-custom-jquery-selector/ > > It sounds like writing a custom selector might be your best bet. You > should be able to do an exact, contains, and starts-with search, > depending on your needs. > > -Eric > > On Sep 23, 7:51 am, blockedmind <[EMAIL PROTECTED]> wrote: > > > hmmm thanks for that i'll check it out but exact search is not enough > > for me... i need *keyword* kind of searching... > > > On 22 Eylül, 19:35, ricardobeat <[EMAIL PROTECTED]> wrote: > > > > my_search = "sEarCh"; //global var, you can't pass arguments to the > > > filter function > > > my_search = new RegExp(my_search,'i'); // 'i' makes the regexp case > > > insensitive > > > > $('h1').filter(function () { > > > return $(this).attr('title').match(my_search); > > > > }); > > > > this might be slow if you're handling large XML files, and it's > > > limited to single word searches or exact concatenated matches. > > > > - ricardo > > > > On Sep 22, 6:27 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote: > > > > > Maybe try using filter and a regexp for the part that you want to be > > > > case > > > > insensitive. Something like (very untested): > > > > $(...).find('item').filter(function() { return this.name.match(new > > > > RegExp(search, 'i')); }).each(function() { > > > > > }); > > > > > I don't recall the syntax for accessing an XML attribute from > > > > javascript, so > > > > the "this.name" part might be wrong. Maybe you need $(this).attr('name') > > > > instead. Also, you might want to be doing more than just passing the > > > > search > > > > into a RegExp, but you get the idea. > > > > > Also, maybe reconsider what you're trying to do. Maybe just return your > > > > xml > > > > such that it's already been converted to lower case, then just do what > > > > you > > > > were doing before except use search.toLowerCase() instead of just > > > > search. > > > > > Hope it helps. > > > > > --Erik > > > > > On Mon, Sep 22, 2008 at 12:35 AM, blockedmind <[EMAIL PROTECTED]> wrote: > > > > > > Nothing? > > > > > > On Sep 20, 5:22 pm, blockedmind <[EMAIL PROTECTED]> wrote: > > > > > > I am making search in an xml file, but I don't get expected results > > > > > > since jQuery selectors arecase-sensitive. I use something like > > > > > > > $(returnedXml).find("item[name*='"+search+"']").each(function(){ > > > > > > > }); > > > > > > > How to make it INCASE-SENSITIVE? > >
[jQuery] Re: Case Insentitive Selectorys
hmmm thanks for that i'll check it out but exact search is not enough for me... i need *keyword* kind of searching... On 22 Eylül, 19:35, ricardobeat <[EMAIL PROTECTED]> wrote: > my_search = "sEarCh"; //global var, you can't pass arguments to the > filter function > my_search = new RegExp(my_search,'i'); // 'i' makes the regexp case > insensitive > > $('h1').filter(function () { > return $(this).attr('title').match(my_search); > > }); > > this might be slow if you're handling large XML files, and it's > limited to single word searches or exact concatenated matches. > > - ricardo > > On Sep 22, 6:27 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote: > > > Maybe try using filter and a regexp for the part that you want to be case > > insensitive. Something like (very untested): > > $(...).find('item').filter(function() { return this.name.match(new > > RegExp(search, 'i')); }).each(function() { > > > }); > > > I don't recall the syntax for accessing an XML attribute from javascript, so > > the "this.name" part might be wrong. Maybe you need $(this).attr('name') > > instead. Also, you might want to be doing more than just passing the search > > into a RegExp, but you get the idea. > > > Also, maybe reconsider what you're trying to do. Maybe just return your xml > > such that it's already been converted to lower case, then just do what you > > were doing before except use search.toLowerCase() instead of just search. > > > Hope it helps. > > > --Erik > > > On Mon, Sep 22, 2008 at 12:35 AM, blockedmind <[EMAIL PROTECTED]> wrote: > > > > Nothing? > > > > On Sep 20, 5:22 pm, blockedmind <[EMAIL PROTECTED]> wrote: > > > > I am making search in an xml file, but I don't get expected results > > > > since jQuery selectors arecase-sensitive. I use something like > > > > > $(returnedXml).find("item[name*='"+search+"']").each(function(){ > > > > > }); > > > > > How to make it INCASE-SENSITIVE?
[jQuery] Re: Case Insentitive Selectorys
Nothing? On Sep 20, 5:22 pm, blockedmind <[EMAIL PROTECTED]> wrote: > I am making search in an xml file, but I don't get expected results > since jQuery selectors arecase-sensitive. I use something like > > $(returnedXml).find("item[name*='"+search+"']").each(function(){ > > }); > > How to make it INCASE-SENSITIVE?
[jQuery] Case Insentitive Selectorys
I am making search in an xml file, but I don't get expected results since jQuery selectors are case-sensitive. I use something like $(returnedXml).find("item[name*='"+search+"']").each(function(){ }); How to make it INCASE-SENSITIVE?