Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 18:31:47
Original
904 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:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!