[jQuery] Re: Suggestion - A | B | C | - Navigation container
Hi Folks I was thinking but If the list have hundreds of itens? We could create a Pager -- 1 | 2 | 3 | 4 ... --- -- ... 5 | 6 | 7 | 8 ... --- in the botton of each letter and limit each list with a user's argument for example 10 itens or 100 itens Just an Idea Regards Mario 2007/5/13, Ⓙⓐⓚⓔ [EMAIL PROTECTED]: the latest version works against the actual text, instead of the html inside the li I.E. It's fixed, thanks to Sam's notice! On 5/13/07, Mario Moura [EMAIL PROTECTED] wrote: Hi If the list have an anchor tag a href=srcJake/a letters.js cant work The result will be A to all itens. My hunch is A from a Regards Mario 2007/5/13, Ⓙⓐⓚⓔ [EMAIL PROTECTED]: Good catch Sam, it's been updated over at google. http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ On 5/13/07, Sam Collett [EMAIL PROTECTED] wrote: On May 13, 2:10 am, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Thanks Mario, I put it up in the plugins directory of the svn.http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ Instead of html() perhaps text() would be better as it wouldn't work as expected when there is a list item like this: listrongSome/strong text/li -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000 -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000
[jQuery] Re: Suggestion - A | B | C | - Navigation container
On May 13, 2:10 am, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Thanks Mario, I put it up in the plugins directory of the svn.http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ Instead of html() perhaps text() would be better as it wouldn't work as expected when there is a list item like this: listrongSome/strong text/li
[jQuery] Re: Suggestion - A | B | C | - Navigation container
Good catch Sam, it's been updated over at google. http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ On 5/13/07, Sam Collett [EMAIL PROTECTED] wrote: On May 13, 2:10 am, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Thanks Mario, I put it up in the plugins directory of the svn .http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ Instead of html() perhaps text() would be better as it wouldn't work as expected when there is a list item like this: listrongSome/strong text/li -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: Suggestion - A | B | C | - Navigation container
Hi If the list have an anchor tag a href=srcJake/a letters.js cant work The result will be A to all itens. My hunch is A from a Regards Mario 2007/5/13, Ⓙⓐⓚⓔ [EMAIL PROTECTED]: Good catch Sam, it's been updated over at google. http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ On 5/13/07, Sam Collett [EMAIL PROTECTED] wrote: On May 13, 2:10 am, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Thanks Mario, I put it up in the plugins directory of the svn.http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ Instead of html() perhaps text() would be better as it wouldn't work as expected when there is a list item like this: listrongSome/strong text/li -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000
[jQuery] Re: Suggestion - A | B | C | - Navigation container
Ok. Done with: var lis = $('ul/a').siblings() I dont know if is the best way but is working. Thanks again Jake. Regards Mario 2007/5/13, Mario Moura [EMAIL PROTECTED]: Hi If the list have an anchor tag a href=srcJake/a letters.js cant work The result will be A to all itens. My hunch is A from a Regards Mario 2007/5/13, Ⓙⓐⓚⓔ [EMAIL PROTECTED]: Good catch Sam, it's been updated over at google. http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ On 5/13/07, Sam Collett [EMAIL PROTECTED] wrote: On May 13, 2:10 am, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Thanks Mario, I put it up in the plugins directory of the svn.http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ Instead of html() perhaps text() would be better as it wouldn't work as expected when there is a list item like this: listrongSome/strong text/li -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000 -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000
[jQuery] Re: Suggestion - A | B | C | - Navigation container
Amazing, Thanks a lot, should be in Jquery Plugins page, Regards Mario 2007/5/12, Ⓙⓐⓚⓔ [EMAIL PROTECTED]: thanks Bill, Like any piece of new code, there are bound to be bugs... click works better here than toggle, so : ?xml version= 1.0 encoding=utf-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en head title letters /title script type=text/javascript src=/js/jquery.js/script script type=text/javascript jQuery.keysOf = function(obj){ var keys = [] for(keys[keys.length] in obj); return keys } jQuery.fn.letters = function(speed){ var ul = jQuery(this) var items = {} var lis = ul.children() var div = jQuery(div/div) .prependTo(ul.parent()) lis.each(function(){ var let = jQuery(this).hide().html().charAt(0).toUpperCase() if (!items[let]) items[let] = [] items[let].push(this) }) var keys = jQuery.keysOf(items).sort().reverse() for (var i in keys){ (function(i){ // scope i jQuery(span + keys[i] +/span) .css({textDecoration: 'underline',cursor:'pointer'}) .click(function(){ lis.hide() jQuery(items[keys[i]]).show(speed,function(){jQuery(this).attr('style','')}) }) .prependTo(div) if (ikeys.length-1) jQuery(span | /span).prependTo(div) })(i) } } jQuery(function($){ $('ul.alpha').letters('slow') }); /script /head body ul class='alpha' lijaime/li linacho/li linoelle/li liandy/li liduncan/li lijake/li lijunior/li lidonna/li limario/li lianna/li libill/li lijohn/li /ul /body /html On 5/11/07, Bil Corry [EMAIL PROTECTED] wrote: Ⓙⓐⓚⓔ wrote on 5/11/2007 5:06 PM: As a plug in: Very cool, thanks for sharing! - Bil -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000
[jQuery] Re: Suggestion - A | B | C | - Navigation container
Thanks Mario, I put it up in the plugins directory of the svn. http://jqueryjs.googlecode.com/svn/trunk/plugins/letters/ On 5/12/07, Mario Moura [EMAIL PROTECTED] wrote: Amazing, Thanks a lot, should be in Jquery Plugins page, Regards Mario 2007/5/12, Ⓙⓐⓚⓔ [EMAIL PROTECTED]: thanks Bill, Like any piece of new code, there are bound to be bugs... click works better here than toggle, so : ?xml version= 1.0 encoding=utf-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en head title letters /title script type=text/javascript src=/js/jquery.js/script script type=text/javascript jQuery.keysOf = function(obj){ var keys = [] for(keys[keys.length] in obj); return keys } jQuery.fn.letters = function(speed){ var ul = jQuery(this) var items = {} var lis = ul.children() var div = jQuery(div/div) .prependTo(ul.parent()) lis.each(function(){ var let = jQuery(this).hide().html().charAt(0).toUpperCase() if (!items[let]) items[let] = [] items[let].push(this) }) var keys = jQuery.keysOf(items).sort().reverse() for (var i in keys){ (function(i){ // scope i jQuery(span + keys[i] +/span) .css({textDecoration: 'underline',cursor:'pointer'}) .click(function(){ lis.hide() jQuery(items[keys[i]]).show(speed,function(){jQuery(this).attr('style','')}) }) .prependTo(div) if (ikeys.length-1) jQuery(span | /span).prependTo(div) })(i) } } jQuery(function($){ $('ul.alpha').letters('slow') }); /script /head body ul class='alpha' lijaime/li linacho/li linoelle/li liandy/li liduncan/li lijake/li lijunior/li lidonna/li limario/li lianna/li libill/li lijohn/li /ul /body /html On 5/11/07, Bil Corry [EMAIL PROTECTED] wrote: Ⓙⓐⓚⓔ wrote on 5/11/2007 5:06 PM: As a plug in: Very cool, thanks for sharing! - Bil -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000 -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: Suggestion - A | B | C | - Navigation container
update the code part to actually write the letters to the screen: JS CODE -- $(document).ready( function() { // declare an array var capArr = []; var capStr = ''; $('li').each(function(){ var cap = $(this).html().substring(0,1); if (capStr.indexOf(cap) != 1) { capArr.push(cap.toUpperCase()); capStr += cap; } }); capStr = '| '; for (i=0;i capArr.sort().length;i++) { capStr += capArr[i] + ' | '; } $('#letters').html(capStr); }); HTML --- div id=letters/div lijaime/li linacho/li linoelle/li liandy/li liduncan/li _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andy Matthews Sent: Friday, May 11, 2007 4:18 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Suggestion - A | B | C | - Navigation container This code gives you an arrary containing the first character of any string inside a list item. You can then do whatever you want with it. I only used the capStr var because I couldn't get indexOf working with the capStr array. I'd also be interested in seeing if anyone has ideas to improve the code. JS CODE --- $(document).ready( function() { // declare an array capArr = []; capStr = ''; $('li').each(function(){ var cap = $(this).html().substring(0,1); if (capStr.indexOf(cap) != 1) { capArr.push(cap.toUpperCase()); capStr += cap; } }); alert(capArr.sort()); delete capStr; }); LIST ITEMS --- lijaime/li linacho/li linoelle/li liandy/li liduncan/li _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mario Moura Sent: Friday, May 11, 2007 3:21 PM To: jquery-en@googlegroups.com Subject: [jQuery] Suggestion - A | B | C | - Navigation container Hi Folks This email is a suggest to a new plugin. Is it possible from a list li create a A/B/C Navigation container? A | B | C | ... Accessible Travel Assisted Living ... If is possible please let me know, If not feel free to use it. Regards Mario
[jQuery] Re: Suggestion - A | B | C | - Navigation container
As a plug in: ?xml version=1.0 encoding=utf-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en head title letters /title script type=text/javascript src=/js/jquery.js/script script type=text/javascript jQuery.keysOf = function(obj){ var keys = [] for(keys[keys.length] in obj); return keys } jQuery.fn.letters = function(speed){ var ul = jQuery(this) var items = {} var lis = ul.children() var div = jQuery(div/div) .prependTo(ul.parent()) lis.each(function(){ var let = jQuery(this).hide().html().charAt(0).toUpperCase() if (!items[let]) items[let] = [] items[let].push(this) }) var keys = jQuery.keysOf(items).sort().reverse() for (var i in keys){ (function(i){ // scope i jQuery(span + keys[i] +/span) .css({textDecoration: 'underline',cursor:'pointer'}) .toggle(function(){ lis.hide() jQuery(items[keys[i]]).show(speed,function(){jQuery(this).attr('style','')}) },function(){ jQuery(items[keys[i]]).hide() }) .prependTo(div) if (ikeys.length-1) jQuery(span | /span).prependTo(div) })(i) } } jQuery(function($){ $('ul.alpha').letters('slow') }); /script /head body ul class='alpha' lijaime/li linacho/li linoelle/li liandy/li liduncan/li lijake/li lijunior/li lidonna/li limario/li lianna/li /ul /body /html
[jQuery] Re: Suggestion - A | B | C | - Navigation container
Ⓙⓐⓚⓔ wrote on 5/11/2007 5:06 PM: As a plug in: Very cool, thanks for sharing! - Bil
[jQuery] Re: Suggestion - A | B | C | - Navigation container
thanks Bill, Like any piece of new code, there are bound to be bugs... click works better here than toggle, so : ?xml version=1.0 encoding=utf-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en head title letters /title script type=text/javascript src=/js/jquery.js/script script type=text/javascript jQuery.keysOf = function(obj){ var keys = [] for(keys[keys.length] in obj); return keys } jQuery.fn.letters = function(speed){ var ul = jQuery(this) var items = {} var lis = ul.children() var div = jQuery(div/div) .prependTo(ul.parent()) lis.each(function(){ var let = jQuery(this).hide().html().charAt(0).toUpperCase() if (!items[let]) items[let] = [] items[let].push(this) }) var keys = jQuery.keysOf(items).sort().reverse() for (var i in keys){ (function(i){ // scope i jQuery(span + keys[i] +/span) .css({textDecoration: 'underline',cursor:'pointer'}) .click(function(){ lis.hide() jQuery(items[keys[i]]).show(speed,function(){jQuery(this).attr('style','')}) }) .prependTo(div) if (ikeys.length-1) jQuery(span | /span).prependTo(div) })(i) } } jQuery(function($){ $('ul.alpha').letters('slow') }); /script /head body ul class='alpha' lijaime/li linacho/li linoelle/li liandy/li liduncan/li lijake/li lijunior/li lidonna/li limario/li lianna/li libill/li lijohn/li /ul /body /html On 5/11/07, Bil Corry [EMAIL PROTECTED] wrote: Ⓙⓐⓚⓔ wrote on 5/11/2007 5:06 PM: As a plug in: Very cool, thanks for sharing! - Bil -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ