February 2015
Intermediate to advanced
232 pages
4h 40m
English
To catch and handle all these different events, Knockout has the event binding. We are going to use it to show and hide the debug panel when the mouse goes over and out of text, with the help of the following code:
index.html template is as follows. Replace the debug div with this new HTML:<div data-bind="event: {
mouseover:showDebug,
mouseout:hideDebug
}">
<h3 style="cursor:pointer">
Place the mouse over to display debug
</h3>
<pre class="well well-lg" data-bind="visible:debug, toJSON: $root"></pre>
</div>This code says that when we set the mouse over the div element, we will show the debug panel. Initially, only the h3 tag content will be displayed.
h3 tag, we will update the ...Read now
Unlock full access