javascript - skrollr plugin to convert colors -
i'm trying write plugin skrollr allow transitions between different kinds of colors annotations.
this code @ moment:
it should run before skrollr , convert every color annotation hsla.
i don't understand why console gives me 3 times same results:
background-color:hsla(56,100,50, 1); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(0,100,50, 0.5); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(0,100,50, 1); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(56,100,50, 1); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(0,100,50, 0.5); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(0,100,50, 1); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(56,100,50, 1); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(0,100,50, 0.5); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(0,100,50, 1); fiddle.jshell.net/nl75k/show/:117
it should be:
background-color:hsla(56,100,50, 1); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(0,100,50, 0.5); fiddle.jshell.net/nl75k/show/:117 background-color:hsla(0,100,50, 1); fiddle.jshell.net/nl75k/show/:117
any idea?
in getalldataelements
iterating on elements , on attributes. each data attribute you're adding elements matches
. div has 3 data attribute, causes added 3 times.
simple fix: break loop
//check if attibute name starts "data-" if (attr.indexof("data-") == 0) { matches.push(element); //add matches break; }
Comments
Post a Comment