How to know if raphael object is hidden?

后端 未结 1 2080
予麋鹿
予麋鹿 2021-02-13 15:11

I am creating a diagram application in which I hide and show few elements e.g.

var c = paper.circle(10, 10, 10);
c.hide()

var c2 = paper.circle(10, 10, 10);
c2.         


        
相关标签:
1条回答
  • 2021-02-13 15:45

    I took a look at the documentation and source code and cooked this up (untested):

    Raphael.el.is_visible = function() {
        return (this.node.style.display !== "none");
    }
    

    Call as follows:

    var c = paper.circle(10, 10, 10);
    c.hide();
    if (c.is_visible())
        alert("Visible");
    else
        alert("Invisible");
    
    0 讨论(0)
提交回复
热议问题