Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p><strong>Note:</strong> As of jQuery 1.7, the <a href="http://api.jquery.com/live/" rel="noreferrer"><code>.live()</code></a> method is deprecated. Use <a href="http://api.jquery.com/on/" rel="noreferrer"><code>.on()</code></a> to attach event handlers. Users of older versions of jQuery should use <a href="http://api.jquery.com/delegate/" rel="noreferrer"><code>.delegate()</code></a> in preference to <a href="http://api.jquery.com/live/" rel="noreferrer"><code>.live()</code></a>.</p> </blockquote> <p>I'm working on the same thing (knockout + jquery mobile). I'm trying to write a blog post about what I've learned but here are some pointers in the meantime. Remember that I'm also trying to learn knockout/jquery mobile.</p> <h2>View-Model and Page</h2> <p>Only use one (1) view-model object per jQuery Mobile-page. Otherwise you can get problems with click-events that are triggered multiple times.</p> <h2>View-Model and click</h2> <p>Only use ko.observable-fields for view-models click-events.</p> <h2>ko.applyBinding once</h2> <p>If possible: only call ko.applyBinding once for every page and use ko.observable’s instead of calling ko.applyBinding multiple times.</p> <h2>pagehide and ko.cleanNode</h2> <p>Remember to clean up some view-models on pagehide. ko.cleanNode seems to disturb jQuery Mobiles rendering - causing it to re-render the html. If you use ko.cleanNode on a page you need to remove data-role’s and insert the rendered jQuery Mobile html in the source code.</p> <pre><code>$('#field').live('pagehide', function() { ko.cleanNode($('#field')[0]); }); </code></pre> <h2>pagehide and click</h2> <p>If you are binding to click-events - remember to clean up .ui-btn-active. The easiest way to accomplish this is using this code snippet:</p> <pre><code>$('[data-role="page"]').live('pagehide', function() { $('.ui-btn-active').removeClass('ui-btn-active'); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload