【问题标题】:django template show content only in a jquery dialogdjango 模板仅在 jquery 对话框中显示内容
【发布时间】:2017-07-21 01:20:27
【问题描述】:

我有一个 Django HTML 模板如下:

{% extends 'base.html' %}
{% block title %}Cloud | Review {% endblock %}

{% block content %}
    {% load static %}
    {% load render_table from django_tables2 %}

    <div id="dialog" title="Dialog">
        <p>Testing a simple Dialog box.</p>
    </div>

    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

    <script>
        function EditDialog() {
            $( "#dialog" ).dialog();
            return false;
        }
    </script>

     <div class="function-page">
         <div class="table-form">
                <div class="function-container">
                    {% render_table reviews %}
                </div>
         </div>
     </div>

{% endblock %}

当用户点击一个链接时,jquery 对话框被启动。问题是当页面加载时,div 内容显示在页面顶部

<div id="dialog" title="Dialog">
    <p>Testing a simple Dialog box.</p>
</div>

是否可以仅在 jquery 对话框中而不是在通常的页面内容中显示此内容。

此外,一旦我通过调用 EditDialog() 显示对话框,该 div 就会从主底层页面中消失。

【问题讨论】:

  • 您想在此页面加载时隐藏此对话框?
  • 对话框被隐藏。它没有显示。 &lt;div id="dialog" title="Dialog"&gt; 应该被隐藏或者只在 jquery 对话框中查看。
  • 很高兴你修好了。

标签: javascript jquery html css django


【解决方案1】:

好的,简单地说:

<div id="dialog" title="Dialog" style="display: none;">
    <p>Testing a simple Dialog box.</p>
</div>

成功了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多