简体   繁体   中英

Popup window with ajax spinner for twitter bootstrap

Is there a standard popup window with ajax spinner in twitter bootstap? Although it should be, I haven't found anything about it.

This is what worked for me on an Ajax call using Font Awesome (as recommended in the accepted answer) and tweaking out the modal style a bit:

<!-- CSS -->
<style>
    #spinner-modal .modal-dialog,
    #spinner-modal .modal-content,
    #spinner-modal .modal-body {
        background: transparent;
        color: rgba(255,255,255,1);
        box-shadow: none;
        border: none;
    }
</style>

<!--[ SPINNER MODAL ]-->
<div class="modal fade" id="spinner-modal">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-body text-center">
                <h3><i class="fa fa-cog fa-spin"></i> Working...</h3>
            </div>
        </div>
    </div>
</div>

<!--[ JS ]-->
<script>
        $('#search-form-input').autocomplete({
            source: '/search.php',
            minLength: 2,
            select: function(event, ui) {
                $('#spinner-modal').modal('show');
                var url = '/a/results/index.php?i=' + ui.item.item_id;
                window.location.href = url;
            }
        });
</script>

You can use bootstrap modal plugin http://twitter.github.com/bootstrap/javascript.html#modals for loading ajax content in popup.

There isn't a bootstrap way to have spinner, but you can do it at your own before showing modal popup.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM