css部分

.swt_bo{background:#fff; position:fixed; bottom:2px; right:2px; z-index:99999; width:294px; height:169px; padding:3px; border:3px solid #b2b2b2; overflow:hidden; _position:absolute;_top:exprssion(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}
.swt_top{ width:294px; height:29px; overflow:hidden; position:relative;}
.swt_top a,.swt_top span{ display:inline-block; float:left; overflow:hidden;}
.swt_top a.swt_on{ width:120px; height:29px; }
.swt_top span{ width:160px; height:28px; border-bottom:1px solid #ccc; line-height:29px; color:#e84040; font-size:12px; font-weight:bold; }
.swt_top span.swt_close{ cursor:pointer; border:none; width:16px; height:16px; background:url(/swt/swt_close.png) no-repeat top; clear:both; position:absolute; top:0px; right:0px; }
.swt_list{ height:103px; overflow:hidden; margin-bottom:10px;}
.swt_list li,.swt_list p{ border-bottom:1px dashed #ccc; overflow:hidden;}
.swt_list p{ height:33px; line-height:34px; font-size:13px;}
.swt_list p a{ float:right; color:#ff0000; margin-right:20px;}
.swt_list p strong a{ float:left; margin:0px; color:#000;}
.swt_list li{ height:22px; line-height:22px; background:url(/swt/fixedbox_arrow.png) no-repeat 3px center; text-indent:1em }
.swt_list li a{ color:#000; font-size:12px;}
.swt_list_w{ height:23px; line-height:23px; overflow:hidden;}
.swt_list_w ul{ width:225px; overflow:hidden;}
.swt_list_w ul li{ height:23px; line-height:23px; background:url(/swt/4.jpg) no-repeat 3px center; text-indent:1.3em;}
.swt_list_w ul li a{ font-size:12px; color:#000; }
.swt_list_w ul li a span{ color:#ff0000; font-size:16px;}
.swt_list_w .swt_ok{ float:right;}
.swt_bo a:hover{ color:#ff0000;}

html部分

<div class=”swt_bo” id=”swt_bos”>
<div class=”swt_top”><a href=”http://blog.aiwebcom.com” class=”swt_on”><img src=”/swt/swt_anl.gif” title=”在线免费咨询” alt=”在线免费咨询”></a><span>在南穗,找到最高的自己!</span><span class=”swt_close” target=”_parent”></span></div>
<div class=”swt_list”>
<ul>
<p><a href=”http://blog.aiwebcom.com”>更多详情</a><strong><a href=”http://blog.aiwebcom.com”>暑期增高好礼大放送</a></strong></p>
<li><a href=”http://blog.aiwebcom.com”>身高在线预测、把握未来</a></li>
<li><a href=”http://blog.aiwebcom.com”>长高6厘米,走向好人生</a></li>
<li><a href=”http://blog.aiwebcom.com”>母爱与正确的增高方法,助我远离“矮矬穷”</a></li>
</ul>
</div>
<div class=”swt_list_w”><a href=”http://blog.aiwebcom.com” class=”swt_ok”><img src=”/swt/5.jpg” alt=”马上预约” title=”马上预约”></a>
<ul class=”swt_ul”>
<li><a href=”http://blog.aiwebcom.com” title=”">暑期增高优惠活动 今日已预约<span>21</span></a></li>
<li><a href=”http://blog.aiwebcom.com” title=”">暑期增高优惠活动 今日已预约<span>22</span></a></li>
<li><a href=”http://blog.aiwebcom.com” title=”">暑期增高优惠活动 今日已预约<span>23</span></a></li>
</ul>
</div>
</div>

js内容 记得要添加jquery库

$(function(){
var _wrap=$('ul.swt_ul');//定义滚动区域
var _interval=4000;//定义滚动间隙时间
var _moving;//需要清除的动画
_wrap.hover(function(){
clearInterval(_moving);//当鼠标在滚动区域中时,停止滚动
},function(){
_moving=setInterval(function(){
var _field=_wrap.find('li:first');//此变量不可放置于函数起始处,li:first取值是变化的
var _h=_field.height();//取得每次滚动高度
_field.animate({marginTop:-_h+'px'},600,function(){//通过取负margin值,隐藏第一行
_field.css('marginTop',0).appendTo(_wrap);//隐藏后,将该行的margin值置零,并插入到最后,实现无缝滚动
})
},_interval)//滚动间隔时间取决于_interval
}).trigger('mouseleave');//函数载入时,模拟执行mouseleave,即自动滚动
var swt_times=6000;
var swt_open=function(){
$(".swt_bo").animate({height:'169px'},"slow");
$(".swt_close").css("backgroundPosition","top");
}
var swt_close=function(){
$(".swt_close").css("backgroundPosition","bottom");
$(".swt_bo").animate({height:'30px'},"slow");
var timing = setTimeout(swt_open,swt_times);
}
$(".swt_close").toggle(swt_close,swt_open);

});

Sorry, the comment form is closed at this time.

   
© 2012 Ai-WEB的博客 Suffusion theme by Sayontan Sinha