given some html with a data binding like this:
<div id="wrapper" data-bind="css: { editing: fieldForEditingProp }">
<div id="edit">
<!-- stuff -->
</div>
<div id="show">
<!-- stuff -->
</div>
</div>
then I have styles:
#wrapper.editing #edit, #wrapper #show {
// show "edit" and hide "show" when "editing"
display: auto;
}
#wrapper.editing #edit, #wrapper #show {
// show "show" and hide "edit" when "editing"
display: show;
}
This technique effectively moves the show/hide implementation to CSS,
but also has it depend on the viewModel so you can control it easily.
--
-barkmadley
sent from an internet enabled device
got the right property value this time and removed comments because
they were confusing.