DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> jQuery入門知識 >> JQuery特效代碼 >> jQuery實現alert,Prompt和confirm對話框
jQuery實現alert,Prompt和confirm對話框
編輯:JQuery特效代碼     
體驗效果:http://hovertree.com/texiao/jquery/34/

js有alert,prompt和confirm對話框,不過不是很美體驗也不是很好,用jQuery也能實現

代碼如下:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>扁平簡約風格jQuery對話框插件 gDialog - 何問起</title><base target="_blank" />
<link href="http://hovertree.com/texiao/jquery/34/css/normalize.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="http://hovertree.com/texiao/jquery/34/css/animate.min.css">
<link rel="stylesheet" href="http://hovertree.com/texiao/jquery/34/css/jquery.gDialog.css">
<style>
button {
border: 0;
}

.container {
margin: 50px auto;
max-width: 728px;
text-align: center;
font-family: Arial;
}

.btn {
background-color: #ED5565;
color: #fff;
padding: 20px;
margin: 10px 30px;
border-radius: 5px;
border-bottom: 3px solid #DA4453;
}
</style>

</head>

<body>
<div><a href="http://hovertree.com/">首頁</a><a href="http://hovertree.com/texiao/">特效</a><a href="http://hovertree.com/h/bjaf/4132lshc.htm">原文</a></div>
<div class="container">
<h1>jQuery gDialog Plugin Exampels</h1>
<button class="btn demo-1">Alert Dialog Box</button>
<button class="btn demo-2">Prompt Dialog Box</button>
<button class="btn demo-3">Prompt Dialog Box</button>
</div>

<script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-2.2.1.min.js"></script>
<script type="text/javascript" src="http://hovertree.com/texiao/jquery/34/js/jquery.gDialog.js"></script>
<script type="text/javascript">
$('.demo-1').click(function(){
$.gDialog.alert("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse libero erat, scelerisque sit amet dolor nec, euismod feugiat massa.", {
title: "Alert對話框 by 何問起",
animateIn: "bounceIn",
animateOut: "bounceOut"
});
});
$('.demo-2').click(function(){
$.gDialog.prompt("Your website", "hovertree.com", {
title: "Prompt對話框 by 何問起",
required: true,
animateIn : "rollIn",
animateOut: "rollOut"
});
});
$('.demo-3').click(function(){
$.gDialog.confirm("Are You Sure?", {
title: "Confirm對話框 by 何問起",
animateIn : "bounceInDown",
animateOut: "bounceOutUp"
});
});
</script>
</body>
</html>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved