GithubHelp home page GithubHelp logo

imodal's Introduction

iModal

移动端模拟弹框,modal,iModal demo

iModal 模拟弹框

简单调用例子调用:

var imodal =  iModal({
    title:'提示',
    content:'我是内容',
    ok:function(){},
    cancel: function(){}
})

快速参数文档:

参数 类型/值 默认 说明
title String/false false false时不显示title
content String ''
ok Function/false false this指向iModal对象,false时不显示该按钮,方法内部return false时,不自动关闭弹层
okText String '确定'
cancel Function/false false this指向iModal对象,false时不显示该按钮,方法内部return false时,不自动关闭弹层
cancelText String '取消'
oninit Function function(){} 初始化时的回调,this指向iModal对象
onshow Function function(){} 显示时的回调,this指向iModal对象
onclose Function function(){} 关闭是的回调,this指向iModal对象
btns Object {} 自定义按钮,下面再做描述
remove Boolean true 关闭时是否移出节点
auto Boolean true 初始化时是否自动打开弹层

btns例子:

    btns:{
        myBtn:{
            text:'我的按钮',
            callback: function(){}
        },
        ...
    }
  • 可以自定义多个按钮;
  • 上面代码将生成 <button class="myBtn">我的按钮</button> 的按钮HTML结构;
  • 同时可以为myBtn编写自定义样式;
  • 如果callbak返回false,点击后不关闭弹层,同时this纸箱iModal对象;
  • 如果超过2个按钮(包括ok&cancel按钮),一个按钮变为纵向排版。

方法文档:

方法名 参数 说明
content html 重新设置内容
show 在设置auto:false时,可以调用show()打开弹层。
close 关闭弹层

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.