<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.line {
background-color: gray;
height: 30px;
overflow: hidden;
line-height: 30px;
}
li {
}
</style>
<script>
</script>
</head>
<body>
<ul class="line">
<li><a href="#">hello</a></li>
<li><a href="#">world</a></li>
<li><a href="#">good</a></li>
</ul>
</body>
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
<script>
(function($) {
$.fn.extend({
"slideUp": function(value) {
var docthis = this;
value = $.extend({
"liHeight": "30",
"time": 2000,
"movetime": 1000
}, value)
function autoplay() {
$("li:first", docthis).animate({ "margin-top": -value.liHeight }, value.movetime, function() {
$(this).css("margin-top", 0).appendTo(".line");
})
}
var anifun = setInterval(autoplay, value.time);
$(docthis).children("li").hover(function() {
clearInterval(anifun);
}, function() {
anifun = setInterval(autoplay, value.time);
})
}
})
})(jQuery)
$('.line').slideUp()
</script>
</html>