jqm-docs.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //set up the theme switcher on the homepage
  2. $('div').live('pagecreate',function(event){
  3. if( !$(this).is('.ui-dialog')){
  4. var appendEl = $(this).find('.ui-footer:last');
  5. if( !appendEl.length ){
  6. appendEl = $(this).find('.ui-content');
  7. }
  8. if( appendEl.is("[data-position]") ){
  9. return;
  10. }
  11. $('<a href="#themeswitcher" data-'+ $.mobile.ns +'rel="dialog" data-'+ $.mobile.ns +'transition="pop">Switch theme</a>')
  12. .buttonMarkup({
  13. 'icon':'gear',
  14. 'inline': true,
  15. 'shadow': false,
  16. 'theme': 'd'
  17. })
  18. .appendTo( appendEl )
  19. .wrap('<div class="jqm-themeswitcher">')
  20. .bind( "vclick", function(){
  21. $.themeswitcher();
  22. });
  23. }
  24. });
  25. //collapse page navs after use
  26. $(function(){
  27. $('body').delegate('.content-secondary .ui-collapsible-content', 'click', function(){
  28. $(this).trigger("collapse")
  29. });
  30. });
  31. function setDefaultTransition(){
  32. var winwidth = $( window ).width(),
  33. trans ="slide";
  34. if( winwidth >= 1000 ){
  35. trans = "none";
  36. }
  37. else if( winwidth >= 650 ){
  38. trans = "fade";
  39. }
  40. $.mobile.defaultPageTransition = trans;
  41. }
  42. $(function(){
  43. setDefaultTransition();
  44. $( window ).bind( "throttledresize", setDefaultTransition );
  45. });