zoukankan      html  css  js  c++  java
  • artDialog提示框、对话框

    /**
     * 警告
     * @param {String}消息内容
     */
    artDialog.alert = function (content, callback) {
    return artDialog({
    id: 'Alert',
    icon: 'warning',
    fixed: true,
    // lock: true,
    250,
    height:50,
    content: content,
    ok: true,
    close: callback
    });
    };

    /**
     * 确认
     * @param {String}消息内容
     * @param {Function}确定button回调函数
     * @param {Function}取消button回调函数
     */
    artDialog.confirm = function (content, yes, no) {
    return artDialog({
    id: 'Confirm',
    icon: 'question',
    fixed: true,
    // lock: true,
    opacity: .1,
    250,
    height:50,
    content: content,
    ok: function (here) {
    return yes.call(this, here);
    },
    cancel: function (here) {
    return no && no.call(this, here);
    }
    });
    };
    /**
     * 提问
     * @param {String}提问内容
     * @param {Function}回调函数. 接收參数:输入值
     * @param {String}默认值
     */
    artDialog.prompt = function (content, yes, value) {
    value = value || '';
    var input;
    
    return artDialog({
    id: 'Prompt',
    icon: 'question',
    fixed: true,
    // lock: true,
    250,
    height:50,
    opacity: .1,
    content: [
    '<div style="margin-bottom:5px;font-size:12px">',
    content,
    '</div>',
    '<div>',
    '<input value="',
    value,
    '" style="18em;padding:6px 4px" />',
    '</div>'
    ].join(''),
    init: function () {
    input = this.DOM.content.find('input')[0];
    input.select();
    input.focus();
    },
    ok: function (here) {
    return yes && yes.call(this, input.value, here);
    },
    cancel: true
    });
    };
    /**
     * 短暂提示
     * @param {String}提示内容
     * @param {Number}显示时间 (默认1.5秒)
     */
    artDialog.tips = function (content, time) {
    return artDialog({
    id: 'Tips',
    title: false,
            cancel: false,
    fixed: true,
    // lock: true,
    250,
    height:50
    })
        .content('<div style="padding: 0 1em;">' + content + '</div>')
    .time(time || 1);
    };
    //右下角滑动通知
    artDialog.notice = function (options) {
    var opt = options || {},
    api, aConfig, hide, wrap, top,
    duration = 800;
    
    var config = {
    id: 'Notice',
    left: '100%',
    top: '100%',
    fixed: true,
    drag: false,
    250,
    height:50,
    resize: false,
    follow: null,
    lock: false,
    init: function(here){
    api = this;
    aConfig = api.config;
    wrap = api.DOM.wrap;
    top = parseInt(wrap[0].style.top);
    hide = top + wrap[0].offsetHeight;
    
    wrap.css('top', hide + 'px')
    .animate({top: top + 'px'}, duration, function () {
    opt.init && opt.init.call(api, here);
    });
    },
    close: function(here){
    wrap.animate({top: hide + 'px'}, duration, function () {
    opt.close && opt.close.call(this, here);
    aConfig.close = $.noop;
    api.close();
    });
    
    return false;
    }
    }; 
    
    for (var i in opt) {
    if (config[i] === undefined) config[i] = opt[i];
    };
    
    return artDialog(config);
    };

    //调用范例:
    art.dialog.alert('人品越来越不那么稳定了,请检查!');
    
    
    art.dialog.confirm('你确定要删除这掉消息吗?', function () {
    art.dialog.tips('运行确定操作');
    }, function () {
    art.dialog.tips('运行取消操作');
    });
    
    
    art.dialog.prompt('请输入图片网址', function (val) {
    art.dialog.tips(val);
    }, 'http://');
    
    
    
    
    art.dialog.tips('数据正在提交..', 2);
    //[more code..]
    art.dialog.tips('成功。已经保存在server');

  • 相关阅读:
    python openpyxl 封装Execl常用操作的方法
    python webdriver grid多节点运行webdriver程序
    url的正则表达式
    基于Erlang VM的函数式编程语言Elixir
    [整理]团队开发效率提升探索一
    FreeBSD应该装gnome3做桌面
    FreeBSD pkg仓库有台湾的镜像了
    再探OAuth2
    【转】Android世界的Swift
    内存只有4G的MBP要怎么破
  • 原文地址:https://www.cnblogs.com/gccbuaa/p/7000538.html
Copyright © 2011-2022 走看看