Home > Web Front-end > JS Tutorial > A few short sentences of jquery code to implement a picture scrolling up and switching_jquery

A few short sentences of jquery code to implement a picture scrolling up and switching_jquery

WBOY
Release: 2016-05-16 18:02:38
Original
1064 people have browsed it

Introduction to animate() parameters: The
animate() method performs custom animations of CSS property sets.
This method changes an element from one state to another through CSS styles. CSS property values ​​change gradually, allowing you to create animated effects.
Only numeric values ​​can be animated (e.g. "margin:30px"). String values ​​cannot be animated (such as "background-color:red").
PS: But if you reference the latest jquery ui framework, attributes such as backgroudColor and color can also implement gradients.
PS: Use "=" or "-=" to create relative animations.
First of all, you still need to reference the jquery framework, you know.
Let’s look at the code again:

Copy the code The code is as follows:





Untitled Document




One

Two

Three








js part also You can achieve a rollback effect like this:
Copy code The code is as follows:

$(document ).ready(function(){
var Top=-350;
var Time=500;
var more=-50;
function move(){
$("#box ").animate({"margin-top":Top more},Time);
$("#box").animate({"margin-top":Top},300);
Top = -350;
if(Top==-1050)
{
Top=0;
more=50;
Time=400;
}
else
{
Time=500;
more=-50;
}
}
setInterval(move,3000);
})
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template