Last active
August 29, 2015 14:07
-
-
Save mikaelbr/a13b8efe37d24ef27600 to your computer and use it in GitHub Desktop.
Conceptual view switching - Avoiding imperative code in beautiful declarative markup.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section> | |
<hgroup> | |
<h1>Hello</h1> | |
<h2>World!</h2> | |
</hgroup> | |
<nav> | |
<ul> | |
<li>Foo</li> | |
<li>bar</li> | |
<li>baz</li> | |
</ul> | |
</nav> | |
<article> | |
<header> | |
<h1>What ever</h1> | |
</header> | |
<placeholder-view id="someId" constraint="SomeType"></placeholder-view> | |
</article> | |
</section> | |
<view id="view1" type="SomeType"> | |
<div> | |
<p>My content here.</p> | |
</div> | |
</view> | |
<view id="view2" type="SomeType"> | |
<div> | |
<p>Separate content here.</p> | |
</div> | |
</view> | |
<script> | |
new ViewSwitcher('#view1', { | |
container: '#someId', | |
visible: function () { | |
// some conditional return true | false | |
} | |
}); | |
new ViewSwitcher('#view2', { | |
container: '#someId', | |
visible: function () { | |
// some conditional return true | false | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment