基于jquery的获取mouse坐标插件的实现代码 - Web前端
作者:98wpeu发布时间:2026-10-09分类:网页前端技术浏览:23
复制代码 代码如下:
/*
* Copyright (c) 2010 刘建华
*
* The above copyright notice shall be
* included in all copies or substantial portions of the Software.
* Example:
<div style="height:1000px">demo</div>
<div id="demo" style="height:50px; background:purple; width:50px;z-index:999999; position:absolute;left:-1000px;top:-1000px;">demo</div>
<scripttype="text/javascript" >
var o = $(document);
o.mouSEMove( function(e){
var d = document.getElementById("demo");
d.style.left = ($.mouse(e).left + 5) + "px";
d.style.top = ($.mouse(e).top + 5) + "px";
});
</script>
*/
/*
* mouse Plugin for JQuery
* Version: 1.0
* Release: 2010-03-30
*/
(function($) {
//MAIn Method
jQuery.mouse = function(e){
var mouseleft = 0;
var mousetop = 0;
if(!($.browser.msIE && /MSIE\s(5\.5|6\.)/.test(navigator.UserAgent)))
{
mouseleft=e.pageX;
mousetop=e.pageY;
}
else
{
var _top = document.compatmode=="CSS1Compat" ? document.documentElement.scrollTop : document.body.scrollTop;
var _left = document.compatMode=="css1Compat" ? document.documentElement.scrollLeft : document.body.scrollLeft;
mouseleft=_left+event.clientX;
mousetop=_top+event.clientY;
}
return {left:mouseleft,top:mousetop} ;
};
})(jquery);
相关推荐
- jQuery ajax serialize() 方法使用示例 - Web前端
- JS遮罩层效果 兼容ie firefox jQuery遮罩层 - Web前端
- ASP.NET MVC中EasyUI的datagrid跨域调用实现代码 - Web前端
- EasySlider 基于jQuery功能强大简单易用的滑动门插件 - Web前端
- 使用jQuery轻松实现Ajax的实例代码 - Web前端
- 关于Jqzoom的使用心得 jquery放大镜效果插件 - Web前端
- JavaScript和JQuery实用代码片段(一) - Web前端
- 一个简单的jQuery插件制作 学习过程及实例 - Web前端
- Jquery ajax不能解析json对象,报Invalid JSON错误的原因和解决方法 - Web前端
- jquery 批量上传图片实现代码 - Web前端
- 网页前端技术排行
-
- 1[Web前端]用javascript实现默认图片替代未显示的图片 - Web前端
- 2分析Iconfont-阿里巴巴矢量常用图标库 - Web前端
- 3jQuery实例教程:制作网页中可折叠的面板 - Web前端
- 4【第六章】Foundation之按钮和下拉功能 - Web前端
- 5基于jquery的滚动条滚动固定div(附演示下载) - Web前端
- 6jQuery编写widget的一些技巧分享 - Web前端
- 7分享精心挑选的12款优秀jQuery Ajax分页插件和教程 - Web前端
- 8jQuery实现鼠标移到元素上动态提示消息框效果 - Web前端
- 9在Mac/PC上远程调试iPhone/iPad上的网页 - Web前端
- 最近发表
-
- WordPress随机显示特色图片插件:Random Post Thumbnails
- KeePass实现Chrome浏览器自动填充密码方法一
- LNMP一键包nginx 301强制跳转到https教程
- KeePass实现Chrome浏览器自动填充密码方法二
- #建站# 免费的VPS管理软件Xshell8/Xftp8中文版下载
- 使用Xshell 8连接VPS教程_电脑登录vps的方法
- WordPress评论界面添加烟花????效果
- 不同浏览器书签同步方案:坚果云+Floccus_详细使用教程
- iOS端KeePassXC客户端APP:Strongbox Password Safe
- 给WordPress评论中的Gravatar头像图片添加ALT属性


