如何将同位素应用于svg节点 [英] How to apply isotope to svg nodes
问题描述
由于大量元素(> 5000),我想将同位素应用于SVG,而不是应用于HTML节点。节点表示为:
< rect class =nodewidth =2height =2/> ;
我使用'.node'作为项目选择器,但同位素似乎找不到元素发生。任何提示,如果这是可能的,或者如果库不能应用于SVG元素?
这里的测试用例: https://jsfiddle.net/geraldo/bL25f73a/
我已经看过Isotope的源代码,不幸的是它看起来像是明确排除了SVG。 elems.forEach(function(elem){
//检查elem是否为实际元素
if(!(elem instanceof HTMLElement)){
return;
}
https://github.com/metafizzy/isotope/blob/master/dist/isotope.pkgd.js#L653
只是为了验证,我做了 $(rect)[0] instanceof HTMLElement
,并返回false。
Because of a big amount of elements (>5000), I'd like to apply isotope to SVG and not to HTML nodes. The nodes are represented as:
<rect class="node" width="2" height="2"/>
I use '.node' as item selector but isotope doesn't seem to find the elements and nothing happens. Any hint if this could be possible or if the library can't be applied to SVG elements?
Here the test case: https://jsfiddle.net/geraldo/bL25f73a/
I've taken a look at the Isotope source code, unfortunately it looks like it's explicitly excluding SVG.
elems.forEach( function( elem ) {
// check that elem is an actual element
if ( !( elem instanceof HTMLElement ) ) {
return;
}
https://github.com/metafizzy/isotope/blob/master/dist/isotope.pkgd.js#L653
Just to verify, I did $("rect")[0] instanceof HTMLElement
and it's returning false.
这篇关于如何将同位素应用于svg节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!