[Javascript] JS Marquee Scroller Question Looped!

Troy III Ajnej trojani2000 at hotmail.com
Sun Aug 6 17:15:03 CDT 2006


Forgot to mention:
This code is tested and working on Windows platform in the following browsers:
NN8; IEx; Fx1.5; Op9 
*If only other browsers could correctly report the "roller" width
 we could have written:
 var scrlwidth = roller.offsetWidth
 if(i < scrlwidth) instead of manually given value
 if(i < 1040)
The following is an Automated version of code that works in IE. 
It works in NN8 correctly only after reloading the page while in 
FX mode! It will loop-scroll in others too, but will introduce a 
jump that will skip some pictures because of incorrect width. 
-No cure for now.
But we can settle down with manual input of "roller" width anyway.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<style>#holder{ position:absolute; left:45px; top:116px; width:344px; height:84px; overflow:hidden; }#roller {  white-space:nowrap; margin-left:0;}

#tailer{display:none}
</style>   <div id="holder">     <div id="roller">    <img src="images/1.jpg" alt="" >    <img src="images/2.jpg" alt="" >    <img src="images/3.jpg" alt="" >    <img src="images/4.jpg" alt="" >    <img src="images/5.jpg" alt="" >    <img src="images/6.jpg" alt="" >    <img src="images/7.jpg" alt="" >    <img src="images/8.jpg" alt="" >    <img src="images/9.jpg" alt="" >  <span id=tailer>
    <img src="images/1.jpg" alt="" >    <img src="images/2.jpg" alt="" >    <img src="images/3.jpg" alt="" >
  </span>   </div>   </div> <SCRIPT>var roller = document.getElementById('roller')var i=0; var scrlwidth = roller.offsetWidth
document.getElementById('tailer').style.display="inline"
function rollnow(){ if(i < scrlwidth){  i++;  roller.style.marginLeft=-i;  }else{i=-4} }   window.setInterval(rollnow, 20);</SCRIPT> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                         Troy III                           progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



With MSN Spaces email straight to your blog. Upload jokes, photos and more. It's free! It's free! 
_________________________________________________________________
Try Live.com: where your online world comes together - with news, sports, weather, and much more.
http://www.live.com/getstarted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060806/8da559a6/attachment.htm>


More information about the Javascript mailing list