【问题标题】:JCanvas add new eventJCanvas 添加新事件
【发布时间】:2014-10-10 08:56:53
【问题描述】:

我想知道我们是否可以添加另一个动态事件,例如点击、触摸启动等。

例如:

$('canvas').drawArc({
  layer:true,
  strokeStyle: '#000',
  strokeWidth: 5,
  x: 100, y: 100,
  radius: 50,
  my_event : function(layer)
  {

  }
});

【问题讨论】:

    标签: jquery jcanvas


    【解决方案1】:

    根据the documentationclicktouchstart 事件已经在 jCanvas 中原生支持。您需要做的就是指定clicktouchstart(分别)作为回调的键名:

    $('canvas').drawArc({
        layer:true,
        strokeStyle: '#000',
        strokeWidth: 5,
        x: 100, y: 100,
        radius: 50,
        click : function(layer)
        {
    
        },
        touchstart : function(layer)
        {
    
        }
    });
    

    【讨论】:

      猜你喜欢
      • 2012-03-17
      • 1970-01-01
      • 2020-10-10
      • 1970-01-01
      • 1970-01-01
      • 2014-12-16
      • 2015-12-19
      • 2012-02-11
      • 1970-01-01
      相关资源
      最近更新 更多