Salı, Mart 13, 2012

Jquery regex selectors

I needed to find some dom elements which have a regex class names in jquery.
Jquery is really awesome and people made some precious contributions to it.
One of them is James Padolsey's regex selector which is found here. It fit my needs
and I used it like this

$('a:regex(class,sometext[0-9]*)').each(function(){
grup="'"+$(this).attr('class').split(' ')[0]+"'" ;
$(this).colorbox({rel:grup});
});
in binding colorbox to newly inserted items to the page by infinite scroll.
All these bold words are names of great jqeury extensions which I have made use of on a page
together with another awesome extension masonry. Extensions, extensions,extensions thats the way
we build web pages nowadays.

Hiç yorum yok: