You can make that first line a bit more compact:
$(li).removeClass(even odd)
--Karl
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Jun 5, 2009, at 11:40 PM, MorningZ wrote:
// delete li
then
$(li).removeClass(even).removeClass(odd)
On Jun 6, 11:25 pm, Karl Swedberg k...@englishrules.com wrote:
You can make that first line a bit more compact:
$(li).removeClass(even odd)
It's still very inefficient. All that is required is for the LIs
below the deleted one to have their class swapped from odd to even and
vice versa.
here's something i put together
var iseven = 0; // a normal 1, 0 switch
var limit = 34; // maximum limit
$(body).prepend('ul class=test\/ul'); // i want to do this as a list
for(var i = 0; i limit; i++) {
if(iseven = 0) {
// if odd
$(.test).append('li class=oddOdd\/li')
iseven = 1;
} else {
//
Thanks everyone for your assistance.
Greatly appreciated.
Dave
-Original Message-
From: RobG [mailto:robg...@gmail.com]
Sent: June-06-09 11:27 AM
To: jQuery (English)
Subject: [jQuery] Re: Even Odd Rows
On Jun 6, 11:25 pm, Karl Swedberg k...@englishrules.com wrote:
You can make
assuming you're always deleting one element at at a time (or in odd
quantities, hehe), how about
$(deleted_element).nextAll().toggleClass('odd').toggleClass('even');
(would be shorter if toggleClass could take multiple classes)
On Jun 5, 4:57 pm, Dave Maharaj :: WidePixels.com
Still not the best solution, but a bit more efficient:
$(li).removeClass(even odd).each(function(i){
$(this).addClass(i%2 ? 'odd' : 'even')
});
On Jun 5, 8:40 pm, MorningZ morni...@gmail.com wrote:
// delete li
then
$(li).removeClass(even).removeClass(odd)
// delete li
then
$(li).removeClass(even).removeClass(odd)
.filter(:odd).addClass(odd)
.end()
.filter(:even).addClass(even);
On Jun 5, 7:57 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
I have a li layout which have the even odd class applied to them. Each
7 matches
Mail list logo