开发者

Raphael js library get attribute value

How can I get an attribute of a rectangle in an event func开发者_Python百科tion? For example, I need to get opacity value. Here is the code:

var j = R.rect(position_x - 40, position_y - 285, 80, 50);
        j.attr({'fill': '#654','stroke':'none'});
        j.rotate(20 * z, position_x, position_y);
        j.mouseover(function (event) {
            this.attr({opacity: "0.5"});
        });


I believe you can just use the attr function with one argument like so:

j.attr('opacity');

For more information, check out the Raphael docs for attr: http://raphaeljs.com/reference.html#attr.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜