Home Web Front-end JS Tutorial jquery seamless scroll up implementation code_jquery

jquery seamless scroll up implementation code_jquery

May 16, 2016 pm 05:39 PM
Seamless scrolling

JS part
Copy code The code is as follows:

$(function (){
var $this = $(".renav");
var scrollTimer;
$this.hover(function(){
clearInterval(scrollTimer);
},function (){
scrollTimer = setInterval(function(){
scrollNews( $this );
}, 2000 );
}).trigger("mouseout");
});
function scrollNews(obj){
var $self = obj.find("ul:first");
var lineHeight = $self.find("li:first").height();
$self.animate({ "margin-top" : -lineHeight "px" },600 , function(){
$self.css({"margin-top":"0px"}).find( "li:first").appendTo($self);
})
}

HTML part
Copy code The code is as follows:

<style type="text/css">
.renav{
width :200px;
height:150px;
line-height:21px;
overflow:hidden;
background:#FFFFFF;
}
.renav li{
height: 21px;
}
</style>
<div class="renav">
<ul style="margin-top: 0px;">
< li><a>Roche</a></li>
<li><a>Resound</a></li>
<li>< a>Not added1</a></li>
<li><a>Not added2</a></li>
<li><a>Not added 3</a></li>
<li><a>Not added 4</a></li>
<li><a>Siemens</a> </li>
<li><a>OMRON</a></li>
</ul>
</div>
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Tips and methods to achieve seamless scrolling effect with CSS Tips and methods to achieve seamless scrolling effect with CSS Oct 25, 2023 pm 12:31 PM

Tips and methods to achieve seamless scrolling effect with CSS

How to use CSS to create a seamless scrolling text carousel effect How to use CSS to create a seamless scrolling text carousel effect Oct 25, 2023 am 10:24 AM

How to use CSS to create a seamless scrolling text carousel effect

Methods and techniques for achieving seamless scrolling news through pure CSS Methods and techniques for achieving seamless scrolling news through pure CSS Oct 19, 2023 am 10:46 AM

Methods and techniques for achieving seamless scrolling news through pure CSS

How to use Vue to achieve seamless scrolling advertising effects How to use Vue to achieve seamless scrolling advertising effects Sep 21, 2023 am 11:24 AM

How to use Vue to achieve seamless scrolling advertising effects

How to use CSS to create a seamless scrolling image carousel effect How to use CSS to create a seamless scrolling image carousel effect Oct 20, 2023 pm 03:37 PM

How to use CSS to create a seamless scrolling image carousel effect

How to use CSS to create a seamless scrolling image display bar effect How to use CSS to create a seamless scrolling image display bar effect Oct 16, 2023 am 08:09 AM

How to use CSS to create a seamless scrolling image display bar effect

How to use CSS to create a seamless scrolling text display effect. How to use CSS to create a seamless scrolling text display effect. Oct 21, 2023 am 09:10 AM

How to use CSS to create a seamless scrolling text display effect.

How to achieve seamless scrolling news notifications using HTML, CSS and jQuery How to achieve seamless scrolling news notifications using HTML, CSS and jQuery Oct 25, 2023 am 11:55 AM

How to achieve seamless scrolling news notifications using HTML, CSS and jQuery

See all articles