diff --git a/src/dynamics.coffee b/src/dynamics.coffee index f62d0ce..81e952e 100644 --- a/src/dynamics.coffee +++ b/src/dynamics.coffee @@ -70,6 +70,8 @@ applyProperties = (el, properties) -> v = "#{v}#{unitForProperty(k, v)}" if isSVG && svgProperties.contains(k) el.setAttribute(k, v) + else if k of el # support animating scrollTop, etc + el[k] = v else el.style[propertyWithPrefix(k)] = v diff --git a/test/dynamics.coffee b/test/dynamics.coffee index 1a35303..b147647 100644 --- a/test/dynamics.coffee +++ b/test/dynamics.coffee @@ -73,6 +73,19 @@ describe 'dynamics.animate', -> done() , 50 + it 'animate scrollTop of a DOM element', (done) -> + el = document.createElement('div') + dynamics.animate(el, { + scrollTop: 100, + }, { + duration: 25, + type: dynamics.easeInOut + }) + setTimeout -> + expect(el.scrollTop).eql('100') + done() + , 50 + it 'animate with a delay', (done) -> el = document.createElement('div') el.style.left = 0