首页 > web前端 > js教程 > 正文

JS实现文字向下滚动完整实例_javascript技巧

WBOY
发布: 2016-05-16 16:15:24
原创
1337 人浏览过

本文实例讲述了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 配合 */
body .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学习者快速成长!