I can't for the life in me understand why this isn't working. This should be a softball for someone. Thanks!
http://jsfiddle.net/ZsA4f/2/
HTML
<div data-bind="foreach:Zones">
<div class="container" data-bind="style:{ top: ZoneY, left: ZoneX }, text: ZoneTest"></div>
</div>
CSS
.container { position: absolute; font-size: .75em; }
Javascript
var viewModel = {
Zones: ko.observableArray([
{
ZoneX: 100,
ZoneY: 100,
ZoneTest: "hello world"
},
{
ZoneX: 200,
ZoneY: 200,
ZoneTest: "rage!"
}
])
};
ko.applyBindings();
You need to specify a unit. 100 and 200 should be 100px
and 200px
respectively
http://jsfiddle.net/ZsA4f/6/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With