jquery 滚动效果插件
1.css
<style>
.fl {
float: left;
}
.slider0 img {
display: block;
width:100px;
padding: 2px;
}
.slider0 li {
background: url("http://www.lampbrother.net/php/statics/images/lamp/php_qiye_bg.png") no-repeat scroll 120px 5px ;
color: #000000;
font-size: 15px;
height: 150px;
margin-left: 10px;
overflow: hidden;
padding: 10px 0;
width: 100%;
}
.slider0 p {
color: #808080;
float: left;
font: 12px/25px Verdana,Tahoma,'Microsoft Yahei','Simsun';
margin: 10px 0 0;
padding-left: 70px;
width: 720px;
}
.slider0 .tit {
color: #333333;
font: 15px/25px Verdana,Tahoma,'Microsoft Yahei','Simsun';
}
</style>
2.html
<div class="wp">
<ul id="slider" class="slider0" style="top: 0px;list-style-type: disc;">
<li style="opacity: 1;">
<a class="fl"><img src="<?=base_url('uploads')?>/tou1.jpg" alt="php视频教程|php教程"></a>
<p class="tit">李明珠</p>
<p>很好!</p>
</li><li style="opacity: 1;">
<a class="fl"><img src="<?=base_url('uploads')?>/tou2.jpg" alt="php视频教程|php教程"></a>
<p class="tit">李海海</p>
<p>good</p>
</li><li style="opacity: 1;">
<a class="fl"><img src="<?=base_url('uploads')?>/tou3.jpg" alt="php视频教程|php教程"></a>
<p class="tit">刘旭东</p>
<p>太棒了!</p>
</li><li style="opacity: 1;">
<a class="fl"><img src="<?=base_url('uploads')?>/tou4.jpg" alt="php视频教程|php教程"></a>
<p class="tit">陈陈</p>
<p>很强大!</p>
</li>
</ul>
</div>
3.js
<script type="text/javascript">
function H$(i) {return document.getElementById(i)}
function H$$(c, p) {return p.getElementsByTagName(c)}
var slider = function () {
function init (o) {
this.id = o.id;
this.at = o.auto ? o.auto : 3;
this.o = 0;
this.pos();
}
init.prototype = {
pos : function () {
clearInterval(this.__b);
this.o = 0;
var el = H$(this.id), li = H$$('li', el), l = li.length;
var _t = li[l-1].offsetHeight;
var cl = li[l-1].cloneNode(true);
cl.style.opacity = 0; cl.style.filter = 'alpha(opacity=0)';
el.insertBefore(cl, el.firstChild);
el.style.top = -_t + 'px';
this.anim();
},
anim : function () {
var _this = this;
this.__a = setInterval(function(){_this.animH()}, 20);
},
animH : function () {
var _t = parseInt(H$(this.id).style.top), _this = this;
if (_t >= -1) {
clearInterval(this.__a);
H$(this.id).style.top = 0;
var list = H$$('li',H$(this.id));
H$(this.id).removeChild(list[list.length-1]);
this.__c = setInterval(function(){_this.animO()}, 20);
//this.auto();
}else {
var __t = Math.abs(_t) - Math.ceil(Math.abs(_t)*.07);
H$(this.id).style.top = -__t + 'px';
}
},
animO : function () {
this.o += 2;
if (this.o == 100) {
clearInterval(this.__c);
H$$('li',H$(this.id))[0].style.opacity = 1;
H$$('li',H$(this.id))[0].style.filter = 'alpha(opacity=100)';
this.auto();
}else {
H$$('li',H$(this.id))[0].style.opacity = this.o/100;
H$$('li',H$(this.id))[0].style.filter = 'alpha(opacity='+this.o+')';
}
},
auto : function () {
var _this = this;
this.__b = setInterval(function(){_this.pos()}, this.at*1000);
}
}
return init;
}();
new slider({id:'slider'})
</script>
jquery 滚动效果插件的更多相关文章
- fullPage教程 -- 整屏滚动效果插件 fullpage详解
1.引用文件 [html] view plain copy print?在CODE上查看代码片派生到我的代码片 <link rel="stylesheet" href=&qu ...
- 95+强悍的jQuery图形效果插件
现在的网站越来越离不开图形,好的图像效果能让你的网站增色不少.通过JQuery图形效果插件可以很容易的给你的网站添加一些很酷的效果. 使用JQuery插件其实比想象的要容易很多,效果也超乎想象.在本文 ...
- javascript跟随滚动效果插件代码(javascript Follow Plugin)
这篇文章介绍了javascript跟随滚动效果插件代码(javascript Follow Plugin),有需要的朋友可以参考一下Js 跟随滚动效果插件支持定义多个跟随ID,采用css fixed属 ...
- jQuery Lightbox效果插件Boxer
演示:http://www.jq22.com/yanshi1139 下载:链接: https://pan.baidu.com/s/1o8zaV2q 密码: 2ccy Boxer 是一款基于 jQuer ...
- jquery 动画效果插件
从jQuery API 文档中可以知道,jQuery自定义动画的函数.animate( properties [, duration] [, easing] [, complete] )有四个参数: ...
- jq无缝滚动效果插件(之前的那个升级改造加强版)
scroll滚动插件 支持上下左右,淡入淡出,滚动时间设置,动画时间设置,鼠标经过是否停止设置 默认配置参数可修改 $(".content").easysroll({ //默认配置 ...
- 分享七款视差滚动效果的jQuery 插件
视差(Parallax)是指从不同的点看一个物体时形成的视觉差异,这个名词是源自希腊文的παράλλαξις (parallaxis),意思是”改变”.在网页设计中,视差滚动(Parallax Scr ...
- 10 款基于 jQuery 的切换效果插件推荐
本文整理了 10 款非常好用的 jQuery 切换效果插件,包括平滑切换和重叠动画等,这些插件可以实现不同元素之间的动态切换. 1. InnerFade 这是一个基于 jQuery 的小插件,可以实现 ...
- 12款响应式 Lightbox(灯箱)效果插件
灯箱效果(Lightbox)是网站中最常用的效果之一,用于实现类似模态对话框的效果.网络上各种 Lightbox 插件琳琅满目,随着响应式设计(Respnsive Design)的发展,这一先进理念也 ...
随机推荐
- linux命令行下使用vboxmanage安装linux系统
环境:Ubuntu 15.10 64bit,virtualbox 5.0.16 准备:下载安装好virtualbox,virtualbox-extensions,准备好iso系统文件,如archlin ...
- PHP安装oracle的php_oci和oci8扩展
环境:centos6.9 php5.3.3 oracle客户端:下载链接:http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277 ...
- Add and Search Word - Data structure design - LeetCode
Design a data structure that supports the following two operations: void addWord(word) bool search(w ...
- 【Kafka】《Kafka权威指南》——分区partition
在上篇的例子里([Kafka]<Kafka权威指南>--写数据), ProducerRecord 对象包含了目标主题.键和值. Kafka 的消息是 一个个 键值对, ProducerRe ...
- NOI模拟题5 Problem A: 开场题
Solution 注意到\(\gcd\)具有结合律: \[ \gcd(a, b, c) = \gcd(a, \gcd(b, c)) \] 因此我们从后往前, 对于每个位置\(L\), 找到每一段不同的 ...
- 【Java】List转化为数组
List转化为数组的两种方式: 第一种: List<String> list = new ArrayList<>(); String [] arr = list.toArray ...
- 说说GestureDetector.OnGestureListener onScroll函数
public abstract boolean onScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) ...
- 【性能优化】——前端性能优化之DOM
前言:本文参考学习自 RenChao Guan的博客,来源FSUX.ME,感谢原作者,本文的思维导图为自己整理 补充: 浏览器工作流程 避免重绘和回流的四种方式的具体实现
- 2017.2.7 开涛shiro教程-第六章-Realm及相关对象(一)
原博客地址:http://jinnianshilongnian.iteye.com/blog/2018398 根据下载的pdf学习. 第六章 Realm及相关对象 1.用户.角色.权限的关系 用户和角 ...
- 2016.6.20 tomcat安装出现No Java Virtual Machine found in..
安装tomcat时,选择安装路径为自定义路径,但是出现提示: No Java Virtual Machine found in.. 心想这和java虚拟机什么关系啊.百度了之后发现,安装过程中有一步是 ...