jQuery how to add another css in code? -
hi have code right on website...
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> var scrollspeed = 50; // speed in milliseconds var step = 1; // how many pixels move per step var current = 0; // current pixel row var imagewidth = 4000; // background image width var headerwidth = screen.width; // how wide header is. //the pixel row start new loop var restartposition = -(imagewidth - headerwidth); function scrollbg(){ //go next pixel row. current -= step; //if @ end of image, go top. if (current == restartposition){ current = 0; } //set css of header. $('#body').css("background-position",current+"px 0"); } //calls scrolling function repeatedly var init = setinterval("scrollbg()", scrollspeed); </script>
i'm trying add second jquery selector to:
$('#body').css("background-position",current+"px 0");
so css background-position property changed 2 elements.
ie 8 not work gradient , background i'm using nested div (class="flash-bg") background picture , want update it's background-position animate in ie well.
how can add "flash-bg" jquery code? there way add next '#body'? or repeat code except '#flash-bg'? thanks!
if want set background-position
on both #body
, .flash-bg
, work:
$('#body, .flash-bg').css("background-position",current+"px 0");
also, in setinterval
, can pass reference function instead of string eval
:ed:
var init = setinterval(scrollbg, scrollspeed);
Comments
Post a Comment