I have this code:
$(window).scroll(function(){
$('#globalnav').css('left',-$(window).scrollLeft());
$('#globalborder').css('left',-$(window).scrollLeft());
$('#backgroundlayer').css('left',-$(window).scrollLeft());
});
How can I make al the variables compiled in just one line? So it should like something like this
$(window).scroll(function(){
$('#globalnav','#globalborder','#backgroundlayer').css('left',-$(window).scrollLeft());
});
,
outside of the'
, you are passing multiple arguments to the jQuery$
function. Using adeneo's answer, you are passing a single argument to$
, which is a string representing a list of selectors.upload
plugin that questioner was using, rather than an issue selecting multiple items byid
, despite the title.