bootbox

最後更新: 2015-01-17

介紹

wrapping JavaScript’s low level dialog methods with Bootstrap’s high level modal (modal.js) functionality.

支援的 box 有 alert, prompt, confirm

HomePage: http://bootboxjs.com/

 

Download

 

https://github.com/makeusabrew/bootbox/releases/download/v4.3.0/bootbox.min.js

Size: 8.53 KB

Version:

Bootbox:4.3 (Bootstrap:3.3.0, jQuery:1.8.3)

 


Usage

<head>
    ..............
    <!-- CSS dependencies -->
    <link rel="stylesheet" type="text/css" href="bootstrap.min.css">
</head>

<body>

    ..............

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-1.11.1.min.js"></script>
    
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    
    <!-- bootbox code -->
    <script src="js/bootbox.min.js"></script>

    <script>
        # bootbox 的 code 寫在這裡, 而且一定要後過 include bootbox.min.js
        # ..............
    </script>

</body>

 


Box

 

# callback is required for confirm and prompt

    - bootbox.alert(message, callback)

    - bootbox.prompt(message, callback)

    - bootbox.confirm(message, callback)

 

# Basic Examples

alert

bootbox.alert("Hello world!", function() {
    ....
});

confirm

bootbox.confirm("Are you sure?", function(result) {
    ....
});

prompt

bootbox.prompt({
    title: "What is your real name?",
    value: "makeusabrew",
    callback: function(result) {
        if (result === null) {
            ....
            } else {
                ....
            }
    }
});

 


 

 

Creative Commons license icon Creative Commons license icon