使用jTopo给Html5 Canva中绘制的元素添加鼠标事件_html5教程技巧
2015-06-29 10:22
459 查看
代码如下:
var node = new JTopo.Node("Hello");
node.setLocation(409, 269);
node.mousedown(function(event){
if(event.button == 2){
node.text = '按下右键';
}else if(event.button == 1){
node.text = '按下中键';
}else if(event.button == 0){
node.text = '按下左键';
}
});
node.mouseup(function(event){
if(event.button == 2){
node.text = '松开右键';
}else if(event.button == 1){
node.text = '松开中键';
}else if(event.button == 0){
node.text = '松开左键';
}
});
node.click(function(event){
console.log("单击");
});
node.dbclick(function(event){
console.log("双击");
});
node.mousedrag(function(event){
console.log("拖拽");
});
node.mouseover(function(event){
console.log("mouseover");
});
node.mousemove(function(event){
console.log("mousemove");
});
node.mouseout(function(event){
console.log("mouseout");
});
var node = new JTopo.Node("Hello");
node.setLocation(409, 269);
node.mousedown(function(event){
if(event.button == 2){
node.text = '按下右键';
}else if(event.button == 1){
node.text = '按下中键';
}else if(event.button == 0){
node.text = '按下左键';
}
});
node.mouseup(function(event){
if(event.button == 2){
node.text = '松开右键';
}else if(event.button == 1){
node.text = '松开中键';
}else if(event.button == 0){
node.text = '松开左键';
}
});
node.click(function(event){
console.log("单击");
});
node.dbclick(function(event){
console.log("双击");
});
node.mousedrag(function(event){
console.log("拖拽");
});
node.mouseover(function(event){
console.log("mouseover");
});
node.mousemove(function(event){
console.log("mousemove");
});
node.mouseout(function(event){
console.log("mouseout");
});
相关文章推荐
- 使用jTopo给Html5 Canva中绘制的元素添加鼠标事件_html5教程技巧
- HTML5的data-*自定义属性
- 给你推荐10款优秀的 HTML5 动画工具
- HTML5 history API,创造更好的浏览体验
- Html5无刷新修改Url,history pushState/replaceState
- 离线安装Cloudera Manager5.3.4与CDH5.3.4(二)
- HTML4.01与HTML5标签
- HTML5中的Range对象的研究
- 离线安装Cloudera Manager5.3.4与CDH5.3.4(一)
- HTML学习笔记(五)_HTML5表单相关元素和属性
- HTML学习笔记(四)_HTML5常用元素与属性
- HTML学习笔记(三)_HTML5常用元素与属性
- HTML学习笔记(二)_HTML5常用元素与属性
- HTML学习笔记(一)_HTML5简介
- HTML5游戏实战《银行卡牌连连看看游戏》
- 在学习HTML5的过程中遇到的奇葩问题及解决方案
- HTML5的 input:file上传类型控制
- js框架Modernizr是什么东西? 他是前端开发HTML5和CSS3的强有力前端js检测类库
- html5手机 input file 上传图片 调用API
- HTML模块化:使用HTML5 Boilerplate模板