|
@@ -27,19 +27,21 @@
|
|
|
</head>
|
|
|
<body>
|
|
|
|
|
|
-<h1 class="text-center m-1"> Welcome to {{ title }} ! </h1>
|
|
|
-<p class="col-8 offset-2 text-center" > <a href="{{ url_for("test.introduce") }}"> {{ about }} </a> </p>
|
|
|
-
|
|
|
-<section class="container mt-2 mb-2">
|
|
|
-{% for message in get_flashed_messages() %}
|
|
|
- <div class="alert alert-info">
|
|
|
- <button type="button" class="close" data-dismiss="alert">×</button>
|
|
|
- {{ message }}
|
|
|
- </div>
|
|
|
-{% endfor %}
|
|
|
-</section>
|
|
|
+<section id="content">
|
|
|
+ <h1 class="text-center m-1"> Welcome to {{ title }} ! </h1>
|
|
|
+ <p class="col-8 offset-2 text-center" > <a href="{{ url_for("test.introduce") }}"> {{ about }} </a> </p>
|
|
|
+
|
|
|
+ <section class="container mt-2 mb-2">
|
|
|
+ {% for message in get_flashed_messages() %}
|
|
|
+ <div class="alert alert-info">
|
|
|
+ <button type="button" class="close" data-dismiss="alert">×</button>
|
|
|
+ {{ message }}
|
|
|
+ </div>
|
|
|
+ {% endfor %}
|
|
|
+ </section>
|
|
|
|
|
|
-{% block body %} {% endblock %}
|
|
|
+ {% block body %} {% endblock %}
|
|
|
+</section>
|
|
|
|
|
|
{% block javascript %}
|
|
|
<script src="https://cdn.staticfile.org/popper.js/0.2.0/popper.min.js"></script>
|
|
@@ -47,5 +49,38 @@
|
|
|
<script src="https://cdn.staticfile.org/bootstrap/4.6.1/js/bootstrap.min.js"></script>
|
|
|
{% endblock %}
|
|
|
|
|
|
+{% block footer %}
|
|
|
+ {# footer 最后加载 #}
|
|
|
+ <footer id="foot" class="pb-3 text-center">
|
|
|
+ <hr>
|
|
|
+ {{ footer }}
|
|
|
+ </footer>
|
|
|
+ <script>
|
|
|
+ function SetFooter (mutationsList, observer) {
|
|
|
+ let foot = document.getElementById('foot')
|
|
|
+ let content_height = content.getBoundingClientRect().bottom
|
|
|
+ let win_height = 0
|
|
|
+ if (window.innerHeight)
|
|
|
+ win_height = window.innerHeight;
|
|
|
+ else if ((document.body) && (document.body.clientHeight))
|
|
|
+ win_height = document.body.clientHeight;
|
|
|
+
|
|
|
+ console.log(foot.clientHeight)
|
|
|
+ if (win_height - content_height - foot.clientHeight <= 0)
|
|
|
+ foot.style.marginTop = "0"
|
|
|
+ else
|
|
|
+ foot.style.marginTop = (win_height - content_height - foot.clientHeight).toString() + "px"
|
|
|
+ }
|
|
|
+ let MutationObserver = window.MutationObserver;
|
|
|
+ let observer = new MutationObserver(SetFooter);
|
|
|
+ let content = document.getElementById('content')
|
|
|
+ observer.observe(content, {
|
|
|
+ attributes: true, // 属性的变动
|
|
|
+ subtree: true, // 是否将观察器应用于该节点的所有后代节点
|
|
|
+ });
|
|
|
+ SetFooter()
|
|
|
+ </script>
|
|
|
+{% endblock %}
|
|
|
+
|
|
|
</body>
|
|
|
</html>
|