Home > Web Front-end > JS Tutorial > body text

jquery implements clicking on the page to calculate the number of clicks_jquery

WBOY
Release: 2016-05-16 16:18:14
Original
4715 people have browsed it

The code is very simple, so I won’t go into too much nonsense here, just give it to you:

Copy code The code is as follows:

$(function(){
var w=0,tip=$("");
Tip.css({
"z-index":99999,position:"absolute",color:"red",display:"none"
              }),
​​​ $("body").append(tip),//The page creates a b tag to display the number
$(document).on("click",function(e){
               var x=e.pageX,y=e.pageY;//Get the clicked page coordinates
               tip.text(" " w).css({//Number plus 1
               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()
});
});

That’s it for the code, I hope you guys like it.

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!