jquery-rockmodels.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * rockmodelmsg 模式窗口
  3. * caratename:rainrock
  4. * caratetime:2014-05-13 21:40:00
  5. * email:admin@rockoa.com
  6. * homepage:www.rockoa.com
  7. */
  8. (function ($) {
  9. //模式提示
  10. $.rockmodelmsg = function(lx, txt, sj,fun){
  11. clearTimeout($.rockmodelmsgtime);
  12. $('#rockmodelmsg').remove();
  13. js.msg('none');
  14. if(!fun)fun=function(){};
  15. if(lx=='none')return;
  16. var s = '<div id="rockmodelmsg" onclick="$(this).remove()" align="center" style="position:fixed;left:45%;top:30%;z-index:9999;border-radius:10px; background:rgba(0,0,0,0.7);color:white;font-size:18px;min-width:80px"><div style="padding:30px;">';
  17. if(lx=='wait'){
  18. if(!txt)txt='处理中...';
  19. s+='<div><img src="images/mloading.gif"></div>';
  20. s+='<div style="padding-top:5px">'+txt+'</div>';
  21. if(!sj)sj= 60;
  22. }
  23. if(lx=='ok'){
  24. if(!txt)txt='处理成功';
  25. s+='<div style="font-size:40px">✔</div>';
  26. s+='<div>'+txt+'</div>';
  27. }
  28. if(lx=='msg' || !lx){
  29. if(!txt)txt='提示';
  30. s+='<div style="font-size:40px;color:red">☹</div>';
  31. s+='<div style="color:red">'+txt+'</div>';
  32. }
  33. s+='</div></div>';
  34. $('body').append(s);
  35. if(!sj)sj = 3;
  36. var le = (winWb()-$('#rockmodelmsg').width())*0.5;
  37. var te = (winHb()-$('#rockmodelmsg').height())*0.5-10;
  38. $('#rockmodelmsg').css({'left':''+le+'px','top':''+te+'px'});
  39. $.rockmodelmsgtime = setTimeout(function(){
  40. $('#rockmodelmsg').remove();
  41. fun();
  42. }, sj*1000);
  43. }
  44. js.msgok = function(msg,fun,sj){
  45. $.rockmodelmsg('ok', msg,sj, fun);
  46. };
  47. js.msgerror = function(msg,fun,sj){
  48. $.rockmodelmsg('msg', msg,sj, fun);
  49. };
  50. js.loading = function(msg,sj){
  51. $.rockmodelmsg('wait', msg,sj);
  52. };
  53. js.unloading= function(){
  54. $.rockmodelmsg('none');
  55. };
  56. })(jQuery);