This article mainly shares with you a piece of code that uses jquery to calculate the number of clicks on a page. It is very practical. If you need it, refer to it. The code is very simple. There is not much nonsense here, and we will provide it directly:
The Code is as follows:
$ (Function (){
Var w = 0, tip = $ ("");
Tip.css ({
"Z-index": 99999, position: "absolute", color: "red", display: "none"
}),
$ ("Body"). append (tip), // create a B tag on the page to display numbers
$ (Document). on ("click", function (e ){
Var x = e. pageX, y = e. pageY; // obtain the coordinate of the clicked page
Tip. text ("+" + too many w).css ({// Add 1 to the number
Display: "block", top: y-15, left: x, opacity: 1 // positioning display
}). Stop (! 0 ,! 1). animate ({// stop (stopAll, goToEnd). If multiple clicks occur, stop the execution of the previous animation.
Top: y-180, opacity: 0}, 800, function (){
Tip. hide ()
}),
E. stopPropagation ()
});
});
The code is here, and I hope my friends will like it.