Raphael canvas (background) onclick event

前端 未结 3 1393
离开以前
离开以前 2021-02-07 08:19

I have been working with Raphael to create drag and drop shapes on a canvas. I do this using the .drag() function (supplied in the Raphael framework) along with my

3条回答
  •  春和景丽
    2021-02-07 08:35

    musefans solution with IE compatiblity. Thanks

    //Create paper element from canvas DIV
    var canvas = $("#Canvas");
    paper = Raphael("Canvas", canvas.width(), canvas.height());
    
    $("#canvas").click(canvasClick);
    
    canvasClick: function(e) {
        if (e.target.nodeName == "svg" || e.target.nodeName == "DIV" )
    
    },
    

提交回复
热议问题