[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 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 Jake > > letters.js cant work > > The result will be A to all itens. My hunch is A from > 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: > > > Some text > > > > > > > > > > > > -- > > Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ > > > > > -- > 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
the latest version works against the actual text, instead of the html inside the 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 Jake letters.js cant work The result will be A to all itens. My hunch is A from : > > 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: > > Some text > > > > > > > -- > Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- 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 Jake letters.js cant work The result will be A to all itens. My hunch is A from : > > 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: > > Some text > > > > > > > -- > Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- 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
Hi If the list have an anchor tag Jake letters.js cant work The result will be A to all itens. My hunch is A from : 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: > Some text > > -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- Mário Alberto Chaves Moura [EMAIL PROTECTED] 31-9157-6000
[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: Some text -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[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: Some text
[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 : > > > http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";> > > http://www.w3.org/1999/xhtml"; xml:lang="en"> > > > letters > > > > 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("") > .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("" + keys[i] +"") > .css({textDecoration: > 'underline',cursor:'pointer'}) > .click(function(){ > lis.hide() > > jQuery(items[keys[i]]).show(speed,function(){jQuery(this).attr('style','')}) > > }) > .prependTo(div) > if (i").prependTo(div) > })(i) > } > } > jQuery(function($){ > $('ul.alpha').letters('slow') > }); > > > > > jaime > nacho > noelle > andy > duncan > jake > junior > donna > mario > anna > bill > john > > > > > > 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
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 : http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en"> letters 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("") .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("" + keys[i] +"") .css({textDecoration: 'underline',cursor:'pointer'}) .click(function(){ lis.hide() jQuery(items[keys[i]]).show(speed,function(){jQuery(this).attr('style','')}) }) .prependTo(div) if (i").prependTo(div) })(i) } } jQuery(function($){ $('ul.alpha').letters('slow') }); jaime nacho noelle andy duncan jake junior donna mario anna bill john 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 Bill, Like any piece of new code, there are bound to be bugs... click works better here than toggle, so : http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en"> letters 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("") .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("" + keys[i] +"") .css({textDecoration: 'underline',cursor:'pointer'}) .click(function(){ lis.hide() jQuery(items[keys[i]]).show(speed,function(){jQuery(this).attr('style','')}) }) .prependTo(div) if (i").prependTo(div) })(i) } } jQuery(function($){ $('ul.alpha').letters('slow') }); jaime nacho noelle andy duncan jake junior donna mario anna bill john 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 -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ|
[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
As a plug in: http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en"> letters 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("") .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("" + keys[i] +"") .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 (i").prependTo(div) })(i) } } jQuery(function($){ $('ul.alpha').letters('slow') }); jaime nacho noelle andy duncan jake junior donna mario anna|
[jQuery] Re: Suggestion - A | B | C | - Navigation container
I'd do it like this.
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en">
letters
jQuery(function($){
var keysOf = function(obj){
var keys = []
for(keys[keys.length] in obj);
return keys
}
var items = {}
var ul = $('ul.alpha')
var div = $("").prependTo(ul.parent())
ul.children().each(function(){
var let = $(this).hide().html().charAt(0).toUpperCase()
if (!items[let]) items[let] = []
items[let].push(this)
})
var keys = keysOf(items).sort().reverse()
for (var i in keys){
(function(){ // real local vars
var keyno=i
var span = $("" + keys[i] +(i==0?'':' | ')
+"").prependTo(div)
span.toggle
(function(){$(items[keys[keyno]]).show()},function(){$(items[keys[keyno]]).hide()})
})()
}
});
jaime
nacho
noelle
andy
duncan
jake
junior
Donna
On 5/11/07, Mario Moura <[EMAIL PROTECTED]> wrote:
Hi Folks
This email is a suggest to a new plugin.
Is it possible from a list 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
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 --- jaime nacho noelle andy duncan _ 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 --- jaime nacho noelle andy duncan _ 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 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
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 --- jaime nacho noelle andy duncan _ 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 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