Giter VIP home page Giter VIP logo

elfdialog's Introduction

elfDialog 一个简易对话框实现 v1.0.1

选项

type dataType:String 可选值有:"dialog" "alert" "confirm" default:"dialog"

类型。不同的类型对话框会有不同的按钮和默认的行为


width dataType:int default:0

宽度。


height dataType:int default:0

高度。


title dataType:String default:""

标题。


value dataType:String default:""

内容。支持HTML文本


submit dataType:Object default:

{
	btnText : "知道了",
	callBack : function(){
		ElfDialog.close();
		return true;
	}
}

对话框类型是alert时的确定按钮。btnText:按钮文本;callBack:按钮点击事件处理函数。


confirm dataType:Object default:

{
	btnText : "确定",
	callBack : function(){
		ElfDialog.close();
		return true;
	}
}

对话框类型是confirm时的确定按钮。btnText:按钮文本;callBack:按钮点击事件处理函数。


cancel dataType:Object default:

{
	btnText : "取消",
	callBack : function(){
		ElfDialog.close();
		return false;
	}
}

对话框类型是confirm时的取消按钮。btnText:按钮文本;callBack:按钮点击事件处理函数。


afterClose dataType:function default:function(){}

对话框关闭后的回调函数。


buttons dataType:Object default:{}

自定义按钮。例如:

{
	"按钮文本1" : function(){
		// do something
		// 按钮点击事件处理函数
	},
	"按钮文本2" : function(){
		// do something
		// 按钮点击事件处理函数
	}
}

overlay dataType:Boolean default:false

是否使用遮罩层。


overlayOpt dataType:Object default:

{
	opacity : 0.2, 
	color : "#000",
	fadeIn : 300
}

遮罩层配置。


autoClose dataType:int default:0

对话框自动关闭延迟时间。0表示不自动关闭。单位为毫秒。

示例截图

普通对话框

普通对话框

确认对话框

确认对话框

elfdialog's People

Contributors

laichendong avatar

Stargazers

 avatar

Watchers

 avatar

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.