Home > Web Front-end > JS Tutorial > The left element implemented by jquery increases by N pixels. When the mouse is removed, it will slowly move to the original position_jquery

The left element implemented by jquery increases by N pixels. When the mouse is removed, it will slowly move to the original position_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:31:47
Original
987 people have browsed it

This control is developed based on Jquery. To reference the Jquery framework
control code

copy the code The code is as follows:

$.fn.myNudge = function() {
var self = $(this);
self.css({ position: "absolute" }); //Make this element absolutely positioned
var selfLeft = self.css("left");
var selfTop = self.css("top");
self.css({ left: selfLeft, top: selfTop }); //Set This element is the original position
self.hover(function() {
self.animate({ left: " =50px" }, 1000);
},
function() {
self.animate({ left: "-=50px" }, 1000);
}
);
}

Usage
HTML code
Copy code The code is as follows:

sadfsadfds

JAVASCRIPT code

Related labels:
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
Latest Issues
Wrong left and right layout
From 1970-01-01 08:00:00
0
0
0
Want to expand search input left
From 1970-01-01 08:00:00
0
0
0
Not shown on the left
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template