拖动时在页面上移动bootbox模式

时间:2017-04-17 11:04:33

标签: javascript twitter-bootstrap-3 drag-and-drop bootbox html5-draggable

我正在构建一个电子应用程序,其中我显示了一个className为settingsModal的启动箱警报。现在我想知道。有没有办法通过使用本机拖放api在页面上移动此警报? (不想使用jQuery UI)。 以下是我的bootbox警报的代码:

 $("#settings").on("click", function() {
        alert({
            title: "Select settings",
            message: `
            <form>
                <label for='category1'>1st category title</label>
                <input type='text' class='form-control' name='category1'/>
                <label for='category2'>2nd category title</label>
                <input type='text' class='form-control' name='category2'/>
                <label for='category3'>3rd category title</label>
                <input type='text' class='form-control' name='category3'/>
                <label for='category4'>4th category title</label>
                <input type='text' class='form-control' name='category4'/>
            </form>
            `,
            buttons: {
                ok: {
                    label: "Save settings",
                    className: "btn-success"
                }
            },
            className: "settingsModal",
            callback: function() {
                var title1 = $("[name='category1']").val();
                var title2 = $("[name='category2']").val();
                var title3 = $("[name='category3']").val();
                var title4 = $("[name='category4']").val();
                if (isEmpty(title1, title2, title3, title4)) {
                    alert("Please fill in all inputs");
                } else {
                    var titleElements = $(".categoryTitle");
                    var titles = [title1, title2, title3, title4];
                    for (var i = 0; i < titleElements.length; i++) {
                        $(titleElements[i]).text(titles[i])
                    }
                }
            }
        });
         //When settings modal appears make it draggable
        $(".settingsModal").attr("draggable",true);
    });

0 个答案:

没有答案