Raphael.js API 之Element.remove(),Element.removeData(),paper.text(),Element.node(),Element.onDragOver

來源:互聯網
上載者:User

標籤:raphael

/*API-38*/
Element.remove()
刪除某個元素對象,無返回值
/*API-39*/
Element.removeData([key]);
刪除某個key的value值,如果沒有特殊說明則刪除所有的元素資料
參數列表:
key
    選擇性參數
    字串類型
    key
返回值:元素對象
/*API-105*/
在畫布上添加一個字串,如果需要換行,使用‘\n‘
參數列表:
x
    number類型
    x軸座標位置
y
    number類型
    y軸座標
text
    字串類型
    常值內容
返回值:type為‘text‘的元素對象
樣本:
var paper = Raphael(document.getElementById("text"),100,100);
var text = paper.text(30,30,‘This is the text‘);

/*API-32*/
Element.node()
給定一個DOM對象,你可以去操作它,為它添加事件。
樣本:/*測試結果不是很好,經常失效,因為你需要點擊到指定位置才會觸發,比如圓圈要點在圓圈邊緣*/
var c = paper.circle(10, 10, 10);
c.node.onclick = function ()
{
    c.attr("fill", "red");
};
/*API-33*/
Element.onDragOver(f)
為 drag.over.<id>事件添加的便捷操作
參數列表:
f   
    function
    {
        執行操作;
    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.