Skip to content

Instantly share code, notes, and snippets.

@arsduo
Created May 24, 2011 11:20
Show Gist options
  • Save arsduo/988553 to your computer and use it in GitHub Desktop.
Save arsduo/988553 to your computer and use it in GitHub Desktop.
jQuery Mobile - page enhancement on demand
/*
* jQuery Mobile Framework : "page" plugin
* Copyright (c) jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
(function($, undefined ) {
$.widget( "mobile.page", $.mobile.widget, {
// other code
_create: function() {
this.enhance();
},
enhance: function() {
var $elem = this.element,
o = this.options;
// rest of the original create function
}
})
// you can then re-enhance the current page after changes by calling
$.mobile.urlHistory.getActive().page.page("enhance")
// ^^ this is a little bulky and would probably want a cleaner interface
// perhaps just a dedicated method to re-enhance the current page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment