//quick & dirty theme switcher, written to potentially work as a bookmarklet (function($){ $.themeswitcher = function(){ var themesDir = 'http://jquerymobile.com/test/themes/', themes = ['default','valencia'], currentPage = $.activePage, menuPage = $( '
' + '
' + '
Switch Theme:
'+ '
'+ '
'+ '
' ) .appendTo( $.pageContainer ), menu = menuPage.find('ul'); //menu items $.each(themes, function( i ){ $('
  • ' + themes[ i ].charAt(0).toUpperCase() + themes[ i ].substr(1) + '
  • ') .click(function(){ addTheme( themes[i] ); done(); return false; }) .appendTo(menu); }); //remover, adder function addTheme(theme){ $('head').append( '' ); } //finished with this function done(){ $.mobile.changePage([menuPage, currentPage], 'pop', true); menuPage.bind('pagehide',function(){ menuPage.remove(); }); return false; } //destroy menuPage.find('.ui-btn-left').click(done); //create page, listview menuPage.page(); //change page now $.mobile.changePage([currentPage, menuPage], 'pop', false); }; })(jQuery);