1. $(function ($) {
    2. window.msgalert = (function () {
    3. var $aol = $('<div id="alertOveryLayer" style="position: fixed; left: 0px; top: 0px; z-index: 99999; text-align: center; bottom: 0px; right: 0px; background-color: rgba(0, 0, 0, 0.298039);"><div style=" position: absolute;display: -moz-box; display: -webkit-box; display: -webkit-flex; display: -moz-flex; display: -ms-flexbox; display: -ms-flex; display: flex;top: 30%;width: 100%;"><div class="alert-lay" style="/* display: table-cell; */vertical-align: middle;padding: 0 10%;-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; display: block; -webkit-box-flex: 1; -moz-box-flex: 1; -webkit-flex: 1 1 0; -moz-flex: 1 1 0; -ms-flex: 1 1 0; flex: 1 1 0; text-align: center;"><div class="overlay-bd" style="background-color: #fff;font-size: 14px;color: #333333;line-height: 24px;padding: 20px 15px;text-align: center;border-radius: 7px 7px 0 0;"></div><div class="overlay-foot" style="border-top: 1px solid #e3e3e3;"><div class="overlay-btn overlay-btn-ok" style="background-color: #fff;cursor: pointer;font-size: 16px;color: #00a1ff;height: 42px;line-height: 42px;border-radius: 0 0 7px 7px;">我知道了</div></div></div></div></div>');
    4. var cb = null;
    5. var sid;
    6. $aol.appendTo(top.document.body);
    7. $aol.hide();
    8. $aol.find(".overlay-btn-ok").click(function () {
    9. $aol.hide();
    10. typeof cb == 'function' && cb();
    11. cb = null;
    12. clearInterval(sid);
    13. });
    14. return function (msg, cbk) {
    15. $aol.find(".overlay-bd").html(msg);
    16. $aol.show();
    17. cb = cbk;
    18. //if(/iphone|ipad|ipod/i.test(navigator.userAgent)){
    19. sid = setInterval(function () {
    20. document.body.scrollIntoView();
    21. }, 50);
    22. };
    23. })();
    24. window.msgconfirm = function (msg, cbk_ok, cbk_no) {
    25. var _this = this;
    26. this.$aol = $('<div id="alertOveryLayer" style="position: fixed; left: 0px; top: 0px; z-index: 99999; text-align: center; bottom: 0px; right: 0px; background-color: rgba(0, 0, 0, 0.298039);"> <div style=" position: absolute;display: -moz-box; display: -webkit-box; display: -webkit-flex; display: -moz-flex; display: -ms-flexbox; display: -ms-flex; display: flex;top: 30%;width: 100%;"> <div class="alert-lay" style="/* display: table-cell; */vertical-align: middle;padding: 0 10%;-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; display: block; -webkit-box-flex: 1; -moz-box-flex: 1; -webkit-flex: 1 1 0; -moz-flex: 1 1 0; -ms-flex: 1 1 0; flex: 1 1 0; text-align: center;"> <div class="overlay-bd" style="background-color: #fff;font-size: 14px;color: #333333;line-height: 24px;padding: 20px 15px;text-align: center;border-radius: 7px 7px 0 0;"> </div> <div class="overlay-foot" style="border-top: 1px solid #e3e3e3;"> <div class="overlay-btn overlay-btn-ok" style="background-color: #fff;cursor: pointer;font-size: 16px;color: #00a1ff;height: 42px;line-height: 42px;border-radius: 0 0 0 7px;width: 50%;float: left;border-right:solid 1px #ddd; ">确定 </div> <div class="overlay-btn overlay-btn-no" style="background-color: #fff;cursor: pointer;font-size: 16px;color: #00a1ff;height: 42px;line-height: 42px;border-radius: 0 0 7px 0;width:50%;float:left;">取消</div> </div> </div> </div> </div>');
    27. this.$aol.appendTo(top.document.body);
    28. this.$aol.find(".overlay-bd").html(msg);
    29. this.$aol.show();
    30. this.cb_ok = cbk_ok;
    31. this.cb_no = cbk_no;
    32. //if(/iphone|ipad|ipod/i.test(navigator.userAgent)){
    33. this.sid = setInterval(function () {
    34. document.body.scrollIntoView();
    35. }, 50);
    36. this.$aol.find(".overlay-btn-ok").click(function () {
    37. _this.$aol.hide();
    38. typeof _this.cb_ok == 'function' && _this.cb_ok();
    39. _this.cb_ok = null;
    40. clearInterval(_this.sid);
    41. });
    42. _this.$aol.find(".overlay-btn-no").click(function () {
    43. _this.$aol.hide();
    44. typeof _this.cb_no == 'function' && _this.cb_no();
    45. _this.cb_no = null;
    46. clearInterval(_this.sid);
    47. });
    48. };
    49. });