问题
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/
回答1:
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.
来源:https://stackoverflow.com/questions/37624854/how-to-apply-isotope-to-svg-nodes