首頁 > web前端 > js教程 > 主體

JS實作文字向下捲動完整實例_javascript技巧

WBOY
發布: 2016-05-16 16:15:24
原創
1338 人瀏覽過

本文實例講述了JS實作文字向下滾動的方法。分享給大家供大家參考。具體實作方法如下:

複製程式碼 程式碼如下:





京東、淘寶曬單

@charset "utf-8";

/*
@名稱: base
@功能: 重設瀏覽器預設樣式
*/

/* 防止使用者自訂背景顏色對網頁的影響,新增讓使用者可以自訂字體 */
html{
    color:#000;background:#fff;
    -webkit-text-size-adjust: 100%;
 -ms-text-size-adjust: 100%;
}

/* 內外邊距通常讓各個瀏覽器樣式的表現位置不同 */
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;
}

/* 重設 HTML5 標籤, IE 需要在 js 中 createElement(TAG) */
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
 display:block;
}

/* HTML5 媒體檔案跟 img 保持一致 */
audio,canvas,video {
 display: inline-block;*display: inline;*zoom: 1;
}

/* 要注意表單元素並沒有繼承父級 font 的問題 */
body,button,input,select,textarea{
font:12px/1.5 tahoma,arial,\5b8b\4f53;
}
input,select,textarea{
font-size:100%;
}

/* 去除各Table cell 的邊距並讓其邊重合 */
table{
border-collapse:collapse;border-spacing:0;
}

/* IE bug fixed: th 不繼承 text-align*/
th{
text-align:inherit;
}

/* 移除預設邊框 */
fieldset,img{
border:0;
}

/* ie6 7 8(q) bug 顯示為行內表現 */
iframe{
display:block;
}

/* 去掉 firefox 下此元素的邊框 */
abbr,acronym{
border:0;font-variant:normal;
}

/* 一致的 del 樣式 */
del {
text-decoration:line-through;
}

address,caption,cite,code,dfn,em,th,var {
font-style:normal;
font-weight:500;
}

/* 去掉列表前的標識, li 會繼承 */
ol,ul {
list-style:none;
}

/* 對齊是排版最重要的因素, 別讓什麼都居中 */
caption,th {
text-align:left;
}

/* 來自yahoo, 讓標題都自訂, 適應多個系統應用程式 */
h1,h2,h3,h4,h5,h6 {
font-size:100%;
font-weight:500;
}

q:before,q:after {
content:'';
}

/* 統一上標與下標 */
sub, sup {
 font-size: 75%; line-height: 0; position: relative; vertical-align: baseline;
}
sup {top: -0.5em;}
sub {bottom: -0.25em;}

a{
    color: #333;
}
/* 讓連結在 hover 狀態下顯示底線 */
a:hover {
    text-decoration:underline;
    color: #c00;
}

/* 預設不顯示底線,保持頁面簡潔 */
ins,a {
text-decoration:none;
}

/* 清理浮動 */
.fn-clear:after {
visibility:hidden;
display:block;
font-size:0;
content:" ";
clear:both;
height:0;
}
.fn-clear {
zoom:1; /* for IE6 IE7 */
}

/* 隱藏, 通常用來與 JS 配合 */
身體 .fn-hide {
display:none;
}

/* 设置内联, 减少浮动带来的bug */
.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 p a{color:#005ea7;}
#club .modle .modle_con .modle_text div a{color:#999999;}





   

   

热门晒单


   
   


<script><br /> $(function(){<br /> function scollDown(id,time){<br />  var liHeight=$("#" id " ul li").height();<br />  var time=time||2500;<br />  setInterval(function(){<br />  $("#" id " ul").prepend($("#" id " ul li:last").css("height","0px").animate({<br />  height:liHeight "px"<br />  },"slow"));<br />  },time);<br /> }<br />     scollDown("modle_left");<br />     scollDown("modle_right",3000);<br /> });<br /> </script>


希望本文所述對大家的javascript程式設計有所幫助。

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!