javascript - How to bind style attribute top and left in rivet.js -
how bind object such i:
var item = function() { this.x = 10; this.y = 10; } var = new item(); to div has style "position: relative; left: {x}; top: {y}"
using http://rivetsjs.com/
you need create custom binder that:
rivets.binders['style-*'] = function(el, value){ el.style.setproperty(this.args[0], value); }; ... ...
<p rv-style-left="item.x" rv-style-top="item.top">
Comments
Post a Comment