<!--开始-->
<div class="ind_cityYelp">
<div class="ind_title">
<h2 class="ind_title_h">目的地点评</h2>
(<a href="#" title="更多目的地">更多</a>)</div>
<div class="ind_cityYelp_roll" > $(function(){ msgmove(); $("#citycommentindex ul").hover(function(){ $(this).attr("name","hovered"); //鼠标经过设置ul的name值为"hovered" },function(){ $(this).removeAttr("name"); }); function msgmove(){ var isIE=!!window.ActiveXObject; var isIE6=isIE&&!window.XMLHttpRequest; if($("#citycommentindex ul").attr("name") != "hovered"){ //判断ul的name属性是否为"hovered",决定下面代码块是否运行,以实现鼠标经过暂停滚动。 var height = $("#citycommentindex li:last").height(); if(isIE6){ //判断IE6,jQuery的animate动画和opacity透明在一起使用在IE6中会出现中文重影现象, //所以在ie6中实行透明的禁用。 $("#citycommentindex li:last").css({"height":0}); }else{ $("#citycommentindex li:last").css({"opacity":0,"height":0}); //列表最后的li透明和高度设置为0 } $("#citycommentindex li:first").before($("#citycommentindex li:last")); //把列表最后的li提升到顶部,实现有限列表项无限循环滚动显示 $("#citycommentindex li:first").animate({"height":height},"slow"); //列表顶部的li高度逐渐变高以把下面的li推下去 if(!isIE6){ $("#citycommentindex li:first").animate({"opacity":"1"},"slow"); //在非IE6浏览器中设置透明淡入效果 } } setTimeout(msgmove,5000); } }); </script> <!--结束-->
css:
/*首页-城市点评*/
.ind_cityYelp { margin-top:10px; padding-bottom:20px; border-bottom:8px solid #f5f4f0;}
.ind_cityYelp_roll { position:relative; width:100%; height:196px; overflow:hidden;}
.ind_cityYelp_list { width:100%; height:196px; overflow:hidden; margin-top:-10px;}
.ind_cityYelp_list li { height:48px; padding:10px 0 10px 58px; border-bottom:1px dashed #e2e2e2;}
.ind_cityYelp_list li img { float:left; display:inline; margin-left:-58px;}
.ind_cityYelp_list li .name { line-height:12px; padding-bottom:2px; color:#636363;}
.ind_cityYelp_list li blockquote { width:100%; height:3em; overflow:hidden;}