0
我已經分配了一個自定義的數據屬性添加到拉斐爾畫布一些圈子作爲一個each()
循環如下:jQuery的 - 拉斐爾 - SVG - 獲取元素的位置用相同的數據屬性到數組
marker.data('transaction', transaction);
怎麼辦我在畫布上找到具有相同事務數據值的元素,並將其位置置於for循環中的數組中,然後對該數組執行操作?
例如,在僞代碼:
for (current_transaction = 1; current_transaction < 10; current_transaction++) {
var array = find the location of elements with transaction data value of
current transaction;
//perform some function with that array
}
我的問題是真的話,你怎麼「getElementByData」,然後搜索使用相同的數據元素。其餘的很簡單。
因此,像http://pastebin.com/gnXf79MR – jacktheripper
沒有,CURRENT_TRANSACTION是一個數字,所以你在做document.querySelectorAll(1) –
VAR發現= document.querySelectorAll('[交易= CURRENT_TRANSACTION] 「); – jacktheripper