javascript - Intercept mouse click coordinates on whole website -
i'm trying write javascript or jquery code in order intercept type of click inside website, whether performed on video, link, image , other page elements, every type of click (if possible distinguished between left , right button) on entire area of web page , save coordinate data, type of click , address of page in db via ajax call. has of idea of code it?
thanks all
a basic outline be:
$('*').on('click', function (e) { // make sure event isn't bubbling if (e.target != this) { return; } // click somewhere // example, make ajax request $.ajax({ type: "post", url: "ajaxurl.php", data: { x: e.pagex, y: e.pagey } }) .done(function( msg ) { alert( "data saved: " + msg ); }); }
Comments
Post a Comment