jquery 滾動效果外掛程式

來源:互聯網
上載者:User

標籤:style   c   class   blog   code   java   

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>

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.