This article describes the method of JS to scroll down text. Share it for your reference. The specific implementation method is as follows:
The code copy is as follows:
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JD.com and Taobao listing</title>
<style>
@charset "utf-8";
/*
@name: base
@Function: Reset the browser default style
*/
/* Prevent the impact of user-defined background color on web pages, add to allow users to customize fonts*/
html{
color:#000;background:#fff;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
/* Inner and outer margins usually make the performance positions of each browser style differently*/
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,arti
cle,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
margin:0;padding:0;
color:#333;
}
/* Reset HTML5 tags, IE needs to createElement(TAG) in js */
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
display:block;
}
/* HTML5 media files are consistent with img*/
audio,canvas,video {
display: inline-block;*display: inline;*zoom: 1;
}
/* Note that form elements do not inherit parent font*/
body,button,input,select,textarea{
font:12px/1.5 tahoma,arial,//5b8b//4f53;
}
input,select,textarea{
font-size:100%;
}
/* Remove the margins of each Table cell and make its edges overlap*/
table{
border-collapse:collapse; border-spacing:0;
}
/* IE bug fixed: th does not inherit text-align*/
th{
text-align:inherit;
}
/* Remove default border*/
fieldset,img{
border:0;
}
/* ie6 7 8(q) bug is displayed as in-line performance*/
iframe{
display:block;
}
/* Remove the border of this element under firefox*/
abbr,acronym{
border:0;font-variant:normal;
}
/* Consistent del style*/
del {
text-decoration:line-through;
}
address,caption,cite,code,dfn,em,th,var {
font-style:normal;
font-weight:500;
}
/* Remove the logo before the list, li will inherit */
ol,ul {
list-style:none;
}
/* Alignment is the most important factor in typography, don't center everything*/
caption,th {
text-align:left;
}
/* From yahoo, make the titles custom, adapt to multiple system applications*/
h1,h2,h3,h4,h5,h6 {
font-size:100%;
font-weight:500;
}
q:before,q:after {
content:'';
}
/* Unified superscript and subscript*/
sub, sup {
font-size: 75%; line-height: 0; position: relative; vertical-align: baseline;
}
sup {top: -0.5em;}
sub {bottom: -0.25em;}
a{
color: #333;
}
/* Let the link display underline in hover state*/
a:hover {
text-decoration:underline;
color: #c00;
}
/* No underline is displayed by default, keeping the page concise*/
ins,a {
text-decoration:none;
}
/* Clean up float*/
.fn-clear:after {
visibility:hidden;
display:block;
font-size:0;
content:" ";
clear: both;
height:0;
}
.fn-clear {
zoom:1; /* for IE6 IE7 */
}
/* Hide, usually used to cooperate with JS*/
body .fn-hide {
display:none;
}
/* Set inline to reduce bugs caused by floating */
.fn-left,.fn-right {
display:inline;
}
.fn-left {
float:left;
}
.fn-right {
float:right;
}
#club{width:888px;height:190px;margin:40px auto;border:1px solid #dddddd;border-radius:5px 5px 0px 0px;}
#club .modle{width:443px;height:190px;border-right:1px solid #dddddd;float:left;}
#club .modle_right{border-right:none;float:right;}
#club .modle .modle_title{width:443px;height:29px;line-height:29px;font-size:12px;font-weight:bold;background:#f3f3f3;}
#club .modle .modle_title span{padding-left:7px;}
#club .modle .modle_con{width:423px;margin:0 auto;height:160px;overflow:hidden;}
#club .modle .modle_con ul li{border-bottom:1px #DDD dotted;position:relative;}
#club .modle .modle_con .modle_img{width:50px;height:79px;text-align:center;}
#club .modle .modle_con .modle_img img{margin-top:14px;}
#club .modle .modle_con .modle_img i{display:block;width:15px;height:17px;background:url(../image/buy.png)no-repeat;position:absolute;top:10px;left:60px;}
#club .modle .modle_con .modle_text{width:337px;height:60px;overflow:hidden;margin-top:15px;padding-left:8px;}
#club .modle .modle_con .modle_text pa{color:#005ea7;}
#club .modle .modle_con .modle_text div a{color:#999999;}
</style>
</head>
<body>
<div id="club">
<div id="modle_left">
<h2><span>Popular list</span></h2>
<div>
<ul>
<li>
<div><a href="###"><img src="image/ho1.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
<li>
<div><a href="###"><img src="image/ho2.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
<li>
<div><a href="###"><img src="image/ho1.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
<li>
<div><a href="###"><img src="image/ho2.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
<li>
<div><a href="###"><img src="image/ho3.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
</ul>
</div>
</div>
<div id="modle_right">
<h2><span>Popular list</span></h2>
<div>
<ul>
<li>
<div><a href="###"><img src="image/ho1.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
<li>
<div><a href="###"><img src="image/ho2.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
<li>
<div><a href="###"><img src="image/ho3.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
<li>
<div><a href="###"><img src="image/ho1.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
<li>
<div><a href="###"><img src="image/ho2.jpg"></a><i></i></div>
<div>
<p><a href="###">A very good electric kettle</a></p>
<div><a href="">Speed very fast. The signal is good and easy to set up. The most important thing is to see how much traffic is used</a></div>
</div>
</li>
</ul>
</div>
</div>
</div><!--club end-->
<script type="text/javascript" src="jquery-1.4.js"></script>
<script>
$(function(){
function scollDown(id,time){
var liHeight=$("#"+id+" ul li").height();
var time=time||2500;
setInterval(function(){
$("#"+id+" ul").prepend($("#"+id+" ul li:last").css("height","0px").animate({
height:liHeight+"px"
},"slow"));
},time);
}
scollDown("modle_left");
scollDown("modle_right",3000);
});
</script>
</body>
</html>
I hope this article will be helpful to everyone's JavaScript programming.