Home > Web Front-end > JS Tutorial > jquery button status effect normal, move up, press_jquery

jquery button status effect normal, move up, press_jquery

WBOY
Release: 2016-05-16 17:26:06
Original
1081 people have browsed it

In the process of web design, we often encounter the various status effects of buttons. Wrote a jquery extension to make this process more convenient!
Be sure to quote Jquery before use;
JqueryExtend.js:

Copy the code The code is as follows:

(function ($) {
//Three styles of Button button replacement, if the isState parameter is True, the pressed state is recorded
$.fn.btnEffect = function (normal, mouseover, mousedown, isState) {
var lastButton;
this.each(function () {
$(this).bind({
mouseover: function () {
if (this != lastButton | | !isState) {
$(this).removeClass().addClass(mouseover)
}
},
mouseout: function () {
if (this != lastButton || !isState) {
$(this).removeClass().addClass(normal)
}
},
mousedown: function () {
if (this != lastButton || ! isState) {
if (lastButton != null) {
$(lastButton).removeClass().addClass(normal);
}

$(this).removeClass(). addClass(mousedown);
lastButton = this;
}
}
});
});
}
})(jQuery);

Sample page Default.aspx:
Copy code The code is as follows:

< %@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="JqueryExtend_Default" %>




















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