jQuery在< div>中设置鼠标位置图形区域 [英] jquery set mouse position inside a <div> graphic area

查看:114
本文介绍了jQuery在< div>中设置鼠标位置图形区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 http://www.flotcharts.org/来实现具有缩放/平移的复杂散点图图形功能,我想将鼠标位置设置为特定的坐标(例如:放大时,我希望光标位于画布的中心).

using http://www.flotcharts.org/ to realize a complex scatterplot graphic with zoom/pan functionalities, i would like to set mouse position at specific coordinates (by example: when doing a zoom in, I would like that cursor would positioned at the center of canvass).

此功能不起作用:

  function setMousePosition(pos) {

  var x = pos.x;
  var y = pos.y;

  var pointX = ( Math.floor(plot.offset().left + plot.p2c(pos).left) );
  var pointY = ( Math.floor(plot.offset().top + plot.p2c(pos).top) );

 $("#placeholder").mouseXPos( pointX ).`mouseYPos`( pointY );

关于mouseXPosmouseYPos,萤火虫说: TypeError:placeholder.mouseXPos不是函数

About mouseXPos and mouseYPos, firebug say: TypeError: placeholder.mouseXPos is not a function

所以我的问题是:在javascript或jquery中有没有一种方法可以在图形区域内设置鼠标坐标?

So my question is: there is a way in javascript or jquery to set mouse coordinates inside a graphic area ?

推荐答案

Javascript

这篇关于jQuery在< div>中设置鼠标位置图形区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆