主要运用了定时器的原理,bind,trigger应用等 复制代码 代码如下: banner切换实现 <BR> /*<BR> * @description: banner切换样式<BR> * @author: lanfeng(beryl)<BR> * @time:2013-02-26<BR> */<BR> /* reset*/<BR> *{ margin: 0; padding: 0;}<BR> body{font:12px/1.5 Tahoma,'\5B8B\4F53',arial,Tahoma,helvetica,sans-serif; color:#333333;background-color:#ffffff;position:relative; }<BR> h1,h2,h3,h4,h5,h6{font-size:100%}<BR> address,em{font-style:normal;}<BR> code,kbd,pre,samp{font-family:courier new,courier,monospace;}<BR> ul,ol{list-style:none outside none;}<BR> fieldset,img{border:0;}<BR> img{vertical-align:middle}<BR> table{border-collapse:collapse;border-spacing:0;font-size:inherit;*font-size:100%;}<BR> input,button,textarea,select{vertical-align:middle;font:100% Helvetica,Arial,sans-serif; color:inherit}<BR> .clearfix:after{content:'.';display:block;height:0;clear:both;visibility:hidden;}<BR> .clearfix{*zoom:1;}<BR> .clear{font-size:0;line-height:0;height:0;clear:both;visibility:hidden;overflow:hidden;} <P> .d-ftab{ width:510px; height: 180px;position: relative; margin: 100px auto;}<BR> .d-fShow ul li{ float: left; width: 510px; height: 180px;}<BR> .d-fShow{ width: 510px; height: 180px; overflow: hidden;}<BR> .d-fShow img{ width: 510px; height: 180px; float: left;}<BR> .d-fs-control{ position: absolute; width:510px; position: absolute; left: 0; bottom: 0; height: 25px; line-height: 25px; <P><BR>background: rgba(0,0,0,0.4);<BR> filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#66000000', <P>EndColorStr='#66000000') ; }<BR> :root .d-fs-control{filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#66000000' <P>,EndColorStr='#66000000')\9 ;}<BR> .d-fs-control ul{ position: absolute; bottom:3px; right: 5px; height: 16px;}<BR> .d-fs-control ul li{width:16px;height:16px; background:#777675;border-radius: 2px 2px 2px 2px; float:left;margin-left:5px; <P>color:#dcdcdc;text-align:center;font-weight:700;cursor:pointer;line-height:16px;filter: alpha(opacity=70); opacity: 0.7;}<BR> .d-fs-control ul li:hover,.d-fs-control ul li.select{background:#ffffff;color:#ff6700;} <P> <BR> $(function(){<BR> var wrap =$('.d-ftab');<BR> var imgs = wrap.find('.d-fShow ul >li');<BR> var len=imgs.length ;<BR> var tabTime=100;<BR> var outTime=4000;<BR> var select='select';<BR> var num =0 ;<BR> var interval;<BR> var type = 'click';<BR> var btns=wrap.find('.d-fs-control ul>li');<BR> btns.bind(type,function(){<BR> var _this=$(this);<BR> _this.addClass('select').siblings ().removeClass('select');<BR> num=_this.prevAll().length;<BR> imgs.stop().eq(num).fadeTo(tabTime,1) ;<BR> imgs.not(':eq('+num+')').filter(':visible').fadeOut(tabTime) ;<BR> return false;<BR>}).eq(num).trigger(type);<BR> var interFunc=function(){<BR> num=(num+1)%len;<BR> btns.eq(num).triggerHandler(type);<BR> }<BR> wrap.bind('mouseover',function(){<BR> clearInterval(interval);<BR> }).bind('mouseout',function(){<BR> interval=setInterval(interFunc,outTime)<BR> }) <P> })<BR> 1 2 3 4 5 效果如下图: