我想模仿一下“热门新闻标题”部分,是html5还是jQuery?如果有人知道他们使用的是什么,那就太好了。
它有一个惊人的淡入淡出效果,那就是我想要一个非常好的定时淡入淡出效果。
发布于 2011-03-06 16:53:09
jQuery的InnerFade插件应该可以满足您的需求。
发布于 2011-03-06 16:54:11
这两个都不是。他们使用prototype和scriptaculous javascript框架。该站点使用AJAX加载RSS stream with the news,然后使用prototype解析它并显示在屏幕上。而连续的新闻切换是一个简单的旧window.setInterval调用。以及here's the script本身。
发布于 2011-03-06 22:17:47
使用jQuery可以很容易地做到这一点。
var div = $('#newsdiv').hide(),
news = ['Top news 1', 'Another top news ', 'Yet another top news'],
arrl = news.length,
counter = 0;
function topNews() {
div.fadeIn(1000).delay(1000).fadeOut(1000, function() {
topNews();
}).text(news[counter++]);
if(arrl<=counter){counter = 0}
}
topNews();在http://jsfiddle.net/xxt5F/1/查看工作示例
https://stackoverflow.com/questions/5209553
复制相似问题