In-depth summary of front-end jquery mouse events during learning

1.click event: trigger
$ ('p'). Click (function () {
});
instance
$ ('p'). Click (function () {
alert ('hello!');
} );
2.dbclick event: two consecutive clicks trigger
$ ('p'). Dbclick (function () {
$ (“p”). SlideToggle ();
});
3.mousedown event: when the mouse is pressed Trigger
$ ('p'). Mousedown (function () {
$ (“p”). SlideToggle ();
});
4.mouseup event: triggered when the mouse is released

$(‘p’).mouseup(function(){});

示例:
$(“button”).mouseup(function(){
$(“p”).slideToggle();
});

5. mouseover event: mouseout event is triggered when the mouse moves from one element to another element
 : mouseout event is triggered when the mouse moves out of the element
   ( p ) . m o u s e o v e r ( f u n c t i o n ( ) ) ; ]     ('p').mouseover(function(){});]    (‘p’).mouseout(function(){});
示例:
$(“p”).mouseover(function(){
$(“p”).css(“background-color”,“yellow”);
});
$(“p”).mouseout(function(){
KaTeX parse error: Expected 'EOF', got '#' at position 31: …ground-color","#̲E9E9E4"); }); …(‘p’).mouseenter(function(){});
  $(‘p’).mouseleave(function(){});
示例
$(“p”).mouseenter(function(){
$(“p”).css(“background-color”,“yellow”);
});
$(“p”).mouseleave(function(){
KaTeX parse error: Expected 'EOF', got '#' at position 31: …ground-color","#̲E9E9E4"); }); …(‘p’).hover(
    function(){},
    function(){}
  );$ (". Table_list tr"). Hover (
Example

function () {
$(this).addClass(“hover”);
},
function () {
KaTeX parse error: Expected 'EOF', got '}' at position 32: …ss("hover"); }̲); **8.toggle事…(‘p’).toggle(
    function(){},
    function(){}
  );
示例
$(“p”).toggle(
function(){
$(“body”).css(“background-color”,“green”);},
function(){
$(“body”).css(“background-color”,“red”);},
function(){
$(“body”).css(“background-color”,“yellow”);}
);

Thank you for your support, if you want to understand the software industry, let's work hard together, and strive to add wei: zzaizhangzeng

Published 23 original articles · Like 11 · Visits 30,000+

Guess you like

Origin blog.csdn.net/weixin_42279584/article/details/84826351
Recommended