
1、新建html文档,在body标签中添加一个div标签,为div标签设置一个id,这里以“demo”为例:
2、在head标签中引入jquery的js文件,这时可以使用cdn链接:
3、添加script标签,在script标签中绑定“demo”,然后使用click函数为div标签绑定点击事件:
可以使用事件绑定机制。如:
$('元素').bind({'touchstart mousedown' : function(){$('#touch_tips').text('按下或触摸') },'touchmove mousemove' : function(){ $('#touch_tips').text('移动中') },'touchend touchcancel mouseup' : function(){ $('#touch_tips').text('松开') }})具体请搜索【touch event】手机触屏事件。注意,不支持windows phone!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)