jQuery多种扁平风格对话框代码



65 258 87



特效描述:jQuery 扁平风格 对话框代码,jQuery多种扁平风格对话框代码

代码结构

1. 引入CSS

<link rel="stylesheet" href="jquery.dialogbox-1.0.css">

2. 引入JS

<script src="jquery.js"></script>
<script src="jquery.dialogbox-1.0.js"></script>

3. HTML代码

<center>
<h1>jQuery Dialogbox Plugin Examples</h1>
<!-- Buttons -->
<br><br>
<button id="normal">Normal Message</button>
<button id="success">Success Message</button>
<button id="warning">Warning Message</button>
<button id="error">Error Message</button>
<br><br>
<button id="yes_no">Yes/No Question</button>
<button id="ok_cancel">OK/Cancel Question</button>
<button id="retry_ignore_abort">Retry/Ignore/Abort Question</button>
<br><br>
<button id="text">Text Prompt</button>
<button id="select">Select Prompt</button>
<br><br>
<!-- Scripts -->
</center>
<script>
    $(document).ready(function(){
        //*********************************************************************************
        // Normal Message
        $("#normal").click(function() {
            $('body').dialogbox({type:"normal",title:"Message",message:"网页特效 - www.51qianduan.com"});
        });
        // Success Message
        $("#success").click(function() {
            $('body').dialogbox({type:"success",title:"Success",message:"51前端 - www.51qianduan.com"});
        });
        // Warning Message
        $("#warning").click(function() {
            $('body').dialogbox({type:"warning",title:"Warning",message:"It's a warning!"});
        });
        // Error Message
        $("#error").click(function() {
            $('body').dialogbox({type:"error",title:"Error",message:"It's an error!"});
        });
        //*********************************************************************************
        // Yes/No Question
        $("#yes_no").click(function() {
            $('body').dialogbox({type:"yes/no",title:"Yes No Question",message:"Your question..."},function($btn){
                if($btn == "yes") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Yes"});
                }
                else if($btn == "no") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: No"});
                }
                else if($btn == "close") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Close"});
                }
            });
        });
        // OK/Cancel Question
        $("#ok_cancel").click(function() {
            $('body').dialogbox({type:"ok/cancel",title:"OK Cancel Question",message:"Your question..."},function($btn){
                if($btn == "ok") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Ok"});
                }
                else if($btn == "cancel") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Cancel"});
                }
                else if($btn == "close") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Close"});
                }
            });
        });
        // Retry/Ignore/Abort Question
        $("#retry_ignore_abort").click(function() {
            $('body').dialogbox({type:"retry/ignore/abort",title:"Retry Ignore Abort Question",message:"Your question..."},function($btn){
                if($btn == "retry") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Retry"});
                }
                else if($btn == "ignore") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Ignore"});
                }
                else if($btn == "abort") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Abort"});
                }
                else if($btn == "close") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Close"});
                }
            });
        });
        //*********************************************************************************
        // Text Prompt
        $("#text").click(function() {
            $('body').dialogbox({type:"text",title:"Text Prompt",message:"Your question..."},function($btn,$ans){
                if($btn == "close") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Close"});
                }
                else if($btn == "ok") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You entered: " + $ans});
                }
            });
        });
        // Select Prompt
        $("#select").click(function() {
            $('body').dialogbox({type:"select",title:"Text Prompt",message:"Your question...",options:"Opt1,Opt2,Opt3"},function($btn,$ans){
                if($btn == "close") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You pressed: Close"});
                }
                else if($btn == "ok") {
                    $('body').dialogbox({type:"normal",title:"Result",message:"You entered: " + $ans});
                }
            });
        });
    });
</script>
<!-- The End -->



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


热门标签: 弹出层拖动 窗口 弹出 弹窗 弹出层 提示框 对话框 遮罩 遮罩层 弹窗插件 切换按钮 表单 表单美化 表单插件 表单美化插件 文字提示框 提示文字 文本框 text文本框 按钮控制

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

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

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