您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

介绍一款jquery特效--无缝向上循环滚动列表

2024/3/28 6:58:15发布10次查看
margin5db79b134e9f6b82c0b36e0489ee08ed: 0px; padding: 0px; font-size: 12px; color: rgb(0, 0, 0); font-family: ΢���ź�, ����; white-space: normal; background-color: rgb(255, 255, 255);>效果呈现
整个列表间隔设定的时间向上移动一个item的高度
html结构:
<div class="slide-title"> <span>title1</span> <span>title2</span> <span>title3</span> </div> <div class="slide-container"><!--css设置时,注意高度是显示多少个item,如:item的高度是30px,显示3个,高度则是 3*30 = 90px --> <ul class="slide-list js-slide-list"> <li class="odd"><span>item1</span><span>item1</span><span>item1</span></li> <li class="even"><span>item2</span><span>item2</span><span>item2</span></li> <li class="even"><span>item2</span><span>item2</span><span>item2</span></li> </ul> </div>
实现思路:
获得js-slide-list下第一个li元素的高度,对它的height或margintop进行一个从有到无的动画变化,代码如下:
var doscroll = function(){ var $parent = $('.js-slide-list'); var $first = $parent.find('li:first'); var height = $first.height(); $first.animate({ height: 0 //或者改成: margintop: -height + 'px' }, 500, function() {// 动画结束后,把它插到最后,形成无缝 $first.css('height', height).appendto($parent); // $first.css('margintop', 0).appendto($parent); });};setinterval(function(){doscroll()}, 2000); demo1demo2
以上就是介绍一款jquery特效--无缝向上循环滚动列表的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product