会用在一些头条新闻上,滚动几条最新文章的标题。
/* headlines */.headlines{ margin:75px auto 0; overflow: hidden;height:29px;width: 94%;}.headlines img{ float: left; margin-right: 13px;}.headlines span{ float: right;}.headlines ul{float: left;width: 72%;}.headlines li{float: left; color: #222; font-size: 22px;}
![headlines.jpg](images/headlines.jpg)
11111111111111111111111111111... 22222222222222222222222222222... 33333333333333333333333333333... 〉
// 文字定时滚动setInterval('autoTime()',2000)function autoTime(){ $(".headlines").find("ul").animate({ marginTop:"-29px" //可用jq获取高度,我给了css中设置的定值 },1000,function(){ $(this).css({marginTop : "0px"}).find("li:first").appendTo(this); })}
![210ce86441595080d97728f88214bd63.png](https://img-blog.csdnimg.cn/img_convert/210ce86441595080d97728f88214bd63.png)