huimv.mobile.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. var huimvMobile = new Object();
  2. //显示加载器
  3. function showLoader() {
  4. //显示加载器.for jQuery Mobile 1.2.0
  5. $.mobile.loading('show', {
  6. text: '加载中...', //加载器中显示的文字
  7. textVisible: true, //是否显示文字
  8. theme: 'a', //加载器主题样式a-e
  9. textonly: false, //是否只显示文字
  10. html: "加载中..." //要显示的html内容,如图片等
  11. });
  12. }
  13. //隐藏加载器.for jQuery Mobile 1.2.0
  14. function hideLoader() {
  15. //隐藏加载器
  16. $.mobile.loading('hide');
  17. }
  18. huimvMobile.loadMobilePage = function(id, url, param, callback) {
  19. var obj = $("#" + id);
  20. //showLoader();
  21. var loadDivObj = jQuery('<div style="border:none;"><table cellspacing="0" cellpadding="0" height="60" style="border:none;"><tr style="border:none;"><td width="29%" style="border:none;"><div align="right" style="border:none;"><img src="images/progress.gif" /><div style="border:none;"><td style="border:none;"><td style="border:none;">页面加载中,请稍候...</td></tr></table></div>');
  22. obj.empty().append(loadDivObj);
  23. if (typeof(param) == 'undefined') {
  24. jQuery.ajaxSetup({
  25. cache : false
  26. });
  27. }
  28. obj.load(url, param, function() {
  29. //hideLoader();
  30. loadDivObj.hide("slow");
  31. if (callback) {
  32. callback();
  33. }
  34. });
  35. };