Jquery based on the implementation of text running up similar to the effect of the horse
- 2020-03-30 03:22:17
- OfStack
To achieve a similar effect, found that the lantern has a space. The effect is not beautiful, so jquery to write a
Page code
Js code
Page code
<div class="recordList">
<ul class="tpl-rotate-recordList" style="margin-top: 0px;">
<li class="tpl-rotate-recordList-item">
congratulations 187****5204 To obtain 1000RBM
</li>
<li class="tpl-rotate-recordList-item">
congratulations 137****1372 To obtain 1000RBM
</li>
<li class="tpl-rotate-recordList-item">
congratulations 156****0276 To obtain 1000RBM
</li>
<li class="tpl-rotate-recordList-item">
congratulations 139****9856 To obtain 1000RBM
</li>
<li class="tpl-rotate-recordList-item">
congratulations 136****0580 To obtain 1000RBM
</li>
<li class="tpl-rotate-recordList-item">
congratulations 136****0580 To obtain 1000RBM
</li>
<li class="tpl-rotate-recordList-item">
congratulations 138****8118 To obtain 1000RBM
</li>
<li class="tpl-rotate-recordList-item">
congratulations 136****5555 To obtain 1000RBM
</li>
<li class="tpl-rotate-recordList-item">
congratulations 136****0580 To obtain 1000RBM
</li>
<li class="tpl-rotate-recordList-item">
congratulations 136****0580 To obtain 1000RBM
</li>
</ul>
</div>
Js code
var AutoScroll = function(a) {
$(a).find("ul:first").animate( {
marginTop : "-20px"
}, 500, function() {
$(this).css( {
marginTop : "0px"
}).find("li:first").appendTo(this)
})
}
if ($(".recordList ul li").length > 0) {
setInterval('AutoScroll(".recordList")', 2000)
} else {
$(".recordList").hide()
}