정보 스크롤 효과 의 실례 설명

8528 단어 정보 스크롤
html:

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="utf-8" />
 <title>      </title>
 <link rel="stylesheet" href="style.css" rel="external nofollow" >
</head>

<body>
<!--           -->
<div id="mooc">
 <!--    -->
 <h3 id="moocTitle">    <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_self">  >></a> </h3>
 <!--      -->
 <!--    -->
 <div id="moocBox">
  <ul id="con1">
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >1.  html5       (  )</a><span>2013-09-18</span></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >2.tab      (  )</a><span>2013-10-09</span></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >3.        (  )</a><span>2013-10-21</span></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >4.HTML+CSS    (  )</a><span>2013-11-01</span></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >5.      (  )</a><span>2013-11-06</span></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >6.        (  )</a><span>2013-11-08</span></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >7.      (  )</a><span>2013-11-15</span></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >8.      (  )</a><span>2013-11-22</span></li>
   <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >9.    “    ”  </a><span>2013-12-06</span></li>
  </ul>
  <ul id="con2">
  </ul>
 </div>
 <!--      -->
</div>
<!--        -->

<script type="text/javascript" src="js.js"></script>
</body>
</html>
css:

body {
 font-size: 12px;
 line-height: 24px;
 text-algin: center;  /*        */
}
body, h3, ul, li, a {
 margin: 0;
 padding: 0;   /*        marign padding   */
}
ul {
 list-style: none;   /*   ul         */
}
a img {
 border: none;  /*     ,      */
}
a {
 color: #333;
 text-decoration: none;  /*       */
}
a:hover {
 color: #ff0000;
}
#mooc {
 width: 399px;
 border: 5px solid #ababab;
 -moz-border-radius: 15px;  /* Gecko browsers */
 -webkit-border-radius: 15px; /* Webkit browsers */
 border-radius: 15px;
 box-shadow: 2px 2px 10px #ababab;
 margin: 50px auto 0;
 text-align: left;    /*         */
}
/*      */
#moocTitle {
 height: 62px;
 overflow: hidden; /*        ,          ,       */
 font-size: 26px;
 line-height: 62px;
 padding-left: 30px;
 background-image: -moz-linear-gradient(top, #f05e6f, #c9394a); /* Firefox */
 background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #f05e6f), color-stop(1, #c9394a)); /* Saf4+, Chrome */
 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8fa1ff', endColorstr='#f05e6f', GradientType=0); /* IE*/
 border: 1px solid #f05e6f;
 -moz-border-radius: 8px 8px 0 0;  /* Gecko browsers */
 -webkit-border-radius: 8px 8px 0 0; /* Webkit browsers */
 border-radius: 8px 8px 0 0;
 color: #fff;
 position: relative;
}
#moocTitle a {
 position: absolute;
 right: 10px;
 bottom: 10px;
 display: inline;
 color: #fff;
 font-size: 12px;
 line-height: 24px;
}
/*      */
#moocBot {
 width: 399px;
 height: 10px;
 overflow: hidden;  /*        ,          ,         */
}
/*      */
#moocBox {
 height: 144px;
 width: 335px;
 margin-left: 25px;
 margin-top: 10px;
 margin-bottom: 10px;
 overflow: hidden; /*       ,          ,         */
}
#mooc ul{
 display: inline-block;
}
#mooc ul li {
 height: 24px;
}
#mooc ul li a {
 width: 180px;
 float: left;
 display: block;
 overflow: hidden;
 text-indent: 15px;
 height: 24px;
}
#mooc ul li span {
 float: right;
 color: #999;
}
js:

var box = document.getElementById("moocBox");
var con1 = document.getElementById("con1");
var con2 = document.getElementById("con2");
var speed = 50;
con2.innerHTML = con1.innerHTML;
function scrollUp() {
 if(box.scrollTop>=con1.scrollHeight){
  box.scrollTop = 0;
 }else {
  box.scrollTop++;
 }
}
var myScroll = setInterval("scrollUp()",speed);
box.onmouseover = function () {
 clearInterval(myScroll);
};
box.onmouseout = function () {
 myScroll = setInterval("scrollUp()",speed);
}
효과 그림:

이상 의 정보 스크롤 효과 의 사례 설명 은 바로 편집장 이 여러분 에 게 공유 한 모든 내용 입 니 다.여러분 께 참고 가 되 고 저 희 를 많이 사랑 해 주 셨 으 면 좋 겠 습 니 다.

좋은 웹페이지 즐겨찾기