Tjorriemorrie
Tjorriemorrie

Reputation: 17292

How to do basic visible with knockoutjs

I want to make one page with static html using sf2. First time using knockout.js and I'm stuck at the very first thing :(

I want to show main content (later add animation) with click from the navigation. I've done the single page tutorial 3 times and it's not helping, I'm not understanding something.

Anyway, here's a fiddle with html extracted. What must I refactor: my setPage gets run and I think it should not.

Upvotes: 1

Views: 354

Answers (1)

soniiic
soniiic

Reputation: 2685

Your methodology is incorrect. Have a look at this jsfiddle and see what you think.

http://jsfiddle.net/7xqjY/

I've edited it quite heavily but I hope that you can see where you were going wrong

FYI, your setPage was executing because when knockout parses the bindings, it executes the function (in your case to determine whether the element is visible)

Upvotes: 2

Related Questions