Jquery allows you to calculate the number of clicks on a page.

Source: Internet
Author: User

Jquery allows you to calculate the number of clicks on a page.

The Code is as follows:

$ (Function (){
Var w = 0, tip = $ ("<B> ");
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 ()
});
});

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.