text 加载ajax popup django html javascript

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 加载ajax popup django html javascript相关的知识,希望对你有一定的参考价值。

1. Add this div in your main template (if you are extending) at the bottom of your body element

<div class="modal"><!-- Place at bottom of page --></div>

2. Add this to your css file

* Start by setting display:none to make this hidden.
   Then we position it in relation to the viewport window
   with position:fixed. Width, height, top and left speak
   for themselves. Background we set to 80% white with
   our animation centered, and no-repeating */
.modal {
    display:    none;
    position:   fixed;
    z-index:    1000;
    top:        0;
    left:       0;
    height:     100%;
    width:      100%;
    background: rgba( 255, 255, 255, .8 ) 
                url('http://i.stack.imgur.com/FhHRx.gif') 
                50% 50% 
                no-repeat;
}

/* When the body has the loading class, we turn
   the scrollbar off with overflow:hidden */
body.loading .modal {
    overflow: hidden;   
}

/* Anytime the body has the loading class, our
   modal element will be visible */
body.loading .modal {
    display: block;
}

3. Add this jquery code

Enjoy! 

        $body = $("body");

        $(document).ajaxStart(
            function() {
                alert("starting")
                $body.addClass("loading");

            }
        );
        $(document).ajaxStop(
            function() {
                alert("Stopping")
                $body.removeClass("loading");
            }
        );

以上是关于text 加载ajax popup django html javascript的主要内容,如果未能解决你的问题,请参考以下文章

来自 django 模板的 Ajax 调用

Django is_ajax 历史回溯

python之路_popup功能实现实例

如何在 django 中重新加载一段网页?

Django中的Ajax调用失败

使用 ajax 和 django 引导弹出窗口和加载内容