我有一个简单的脚本,可以捕获所有鼠标单击,除非您单击实际起作用的东西.链接,Flash视频等.在视频加载,新页面加载等之前,无论用户单击什么,如何进行调整?它都会发送我构建的简单GET请求?
(function($) {
$.fn.saveClicks = function() {
$(this).bind('mousedown.clickmap',function(evt) {
var clickDocument = (document.documentElement != undefined && document.documentElement.clientHeight != 0) ? document.documentElement : document.body;
var width = clickHeatDocument.clientWidth != undefined ? clickDocument.clientWidth : window.innerWidth;
var height = clickHeatDocument.clientHeight != undefined ? clickDocument.clientHeight : window.innerHeight;
var scrollx = window.pageXOffset == undefined ? clickDocument.scrollLeft : window.pageXOffset;
var scrolly = window.pageYOffset == undefined ? clickDocument.scrollTop : window.pageYOffset;
var x = evt.clientX + scrollx;
var y = evt.clientY + scrolly;
$.get('/click-save.PHP',{
"x":x,"y":y,"click":"true","w":width,"h":height,"l":escape(document.location.pathname),"d":escape(document.domain)
});
});
};
})(jQuery);
$(function() {
$(document).saveClicks();
});
最佳答案
原文链接:https://www.f2er.com/jquery/531067.html