jQuery多種扁平風格對話框代碼



71 283 95



特效描述: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.cqetom.live"});
        });
        // Success Message
        $("#success").click(function() {
            $('body').dialogbox({type:"success",title:"Success",message:"51前端 - www.cqetom.live"});
        });
        // 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

加群請備注:從官網了解到

老夫子电子