首页 > 移动平台 > 详细

手机移动端alert替换方案

时间:2015-07-09 19:26:46      阅读:772      评论:0      收藏:0      [点我收藏+]
//alert 
;(function () { 
    var AlertBox = function (options){
        this.defaults = {
            title:"",
            callback:null
        },
        this.options = $.extend({}, this.defaults, options);
    };
    AlertBox.prototype = {
        constructor: AlertBox,
        init:function(){
            var teml = "";
            teml=teml+‘<div id="alertbox">‘;
            teml=teml+‘        <p id="msgA">‘+this.options.title+‘</p>‘;
            teml=teml+‘</div>‘;
            if($("#alertbox").length===0){
                $("body").append(teml);
            }else{
                $("#alertbox>#msgA").html(this.options.title);
            }
            $("#alertbox").stop(1,1).fadeIn();
            setTimeout(function (){
                $("#alertbox").stop(1,1).fadeOut();
            }, 2000);
            if(typeof (this.options.callback)=="function"){
                this.options.callback();
            }
        }
    };
    $.AlertBox=function(options){
        var alertBox = new AlertBox(options);
        return alertBox.init();    
    };
}()); 

 

手机移动端alert替换方案

原文:http://www.cnblogs.com/skmtpsh/p/4633809.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!