在kineticjs中将className添加到图像中

时间:2015-01-19 16:03:42

标签: javascript image class kineticjs

我想为图片添加课程名称。这是对的吗?谁能说出来?

var image = new Kinetic.Image({
    name: data,
    id: "image"+(imageCount++),
    x: 10,
    y: 10,
    image: theImage,
    className:"group",
    draggable: false
});

1 个答案:

答案 0 :(得分:0)

这应该将类添加到图像中(假设' theImage'是对图像DOM元素的引用):

var image = new Kinetic.Image({
    name: data,
    id: "image"+(imageCount++),
    x: 10,
    y: 10,
    image: theImage,
    draggable: false
});

theImage.className += ' group';