Jquery click page to calculate the number of clicks _ jquery

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.