利用jQuery实现弹出层对话框插件



37 147 50



特效描述:利用jQuery实现 弹出层 对话框插件,利用jQuery实现弹出层对话框插件

代码结构

1. 引入CSS

<link rel="stylesheet" href="css/easyhelper.min.css">

2. 引入JS

<script src="js/es6-shim.min.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/jquery.transit.min.js"></script>
<script src="js/easyhelper.min.js"></script>

3. HTML代码

<div class="wrapper">
	<button class="helper-button-info" id="dialog-info">info 对话框</button>
	<button class="helper-button-info" id="dialog-success">success 对话框</button>
	<button class="helper-button-info" id="dialog-warn">warn 对话框</button>
	<button class="helper-button-info" id="dialog-error">error 对话框</button>
</div>
<script>
	$( "#dialog-info" ).on("click", function () {
		Helper.ui.dialogInfo( "对话框标题", "对话框内容" );
	})
	$( "#dialog-success" ).on("click", function () {
		Helper.ui.dialogSuccess( "对话框标题", "对话框内容" );
	})
	$( "#dialog-warn" ).on("click", function () {
		Helper.ui.dialogWarn( "对话框标题", "对话框内容" );
	})
	$( "#dialog-error" ).on("click", function () {
		Helper.ui.dialogError( "对话框标题", "对话框内容" );
	})
</script>
<div class="wrapper">
	<button class="helper-button-info" id="dialog-1">基础对话框</button>
	<button class="helper-button-info" id="dialog-2">全屏对话框</button>
	<button class="helper-button-info" id="dialog-3">可拖动对话框</button>
	<button class="helper-button-info" id="dialog-4">暗黑模式对话框</button>
</div>
<script>
	$( "#dialog-1" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容"
		});
	})
	$( "#dialog-2" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			fullscreen: true
		});
	})
	$( "#dialog-3" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			draggable: true
		});
	})
	$( "#dialog-4" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			darkMode: true
		});
	})
</script>
<div class="wrapper">
	<button class="helper-button-info" id="dialog-5">设置宽度</button>
	<button class="helper-button-info" id="dialog-6">隐藏按钮</button>
	<button class="helper-button-info" id="dialog-7">设置按钮文字</button>
	<button class="helper-button-info" id="dialog-8">按钮事件</button>
</div>
<script>
	$( "#dialog-5" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			width: 1000
		});
	})
	$( "#dialog-6" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			showButton: false
		});
	})
	$( "#dialog-7" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			yesText: "我要确定",
			noText: "我要取消"
		});
	})
	$( "#dialog-8" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			yesCallback: function () {
				alert( "确定" );
			},
			noCallback: function () {
				alert( "取消" );
			}
		});
	})
</script>
<div class="wrapper">
	<button class="helper-button-info" id="dialog-9">自动关闭</button>
	<button class="helper-button-info" id="dialog-10">嵌套 iframe</button>
	<button class="helper-button-info" id="dialog-11">内容背景色</button>
	<button class="helper-button-info" id="dialog-12">隐藏遮罩层</button>
</div>
<script>
	$( "#dialog-9" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			autoClose: 5000
		});
	})
	$( "#dialog-10" ).on("click", function () {
		Helper.ui.dialog({
			title: "嵌入 iframe",
			width: 1200,
			contentHeight: 500,
			contentScroll: false,
			iframe: "http://www.baidu.com/"
		});
	})
	$( "#dialog-11" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			contentBgColor: "#f3f3f3"
		});
	})
	$( "#dialog-12" ).on("click", function () {
		Helper.ui.dialog({
			title: "对话框标题",
			content: "对话框内容",
			mask: false
		});
	})
</script>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 弹出层拖动 窗口 弹出 弹窗 弹出层 提示框 对话框 遮罩 遮罩层 弹窗插件 提示框/弹出层

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到