Sunday, 13 May 2012

Jquery text scrolling

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Simple jQuery scrolling function by Max Vergelli</title>
<style type="text/css">
     div.scroller{        
position:relative;        
height:24px;        
width:200px;        
display:block;        
overflow:hidden;        
border:#CCCCCC 1px solid;    
}    
div.scrollingtext{        
position:absolute;        
white-space:nowrap;        
font-family:'Trebuchet MS',Arial;        
font-size:18px;        
font-weight:bold;        
color:#000000;    
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript">
</script>
<script type="text/javascript">
$(document).ready(function() {      
$('.scrollingtext').bind('marquee', function() {        
var ob = $(this);        
var tw = ob.width();        
var ww = ob.parent().width();        
ob.css({ left: -tw });        
ob.animate({ left: ww }, 20000, 'linear', function() {            
ob.trigger('marquee');         });     }).trigger('marquee');   });
 </script>
</head>
<body> 
<div class="scroller">    
<div class="scrollingtext">scrolling text     </div>
</div> 
</body>

No comments:

Post a Comment