Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiple stored elements .css()

I have this jQuery code:

nextimg = $('.index-slide-container img#' + next);
nextcaption = $('.index-slide-container .index-slide').filter('#'+next);

nextimg.css({
    'left':'100%',
    'z-index':'99'
});
nextcaption.css({
    'left':'100%',
    'z-index':'99'
});

I want to know if you can somehow combine/chain the two .css functions into one?

like image 623
Bill Avatar asked Jun 28 '26 00:06

Bill


1 Answers

You can use the jQuery add() function:

nextimg.add(nextcaption).css({
    'left':'100%',
    'z-index':'99'
});
like image 191
BenM Avatar answered Jun 29 '26 19:06

BenM