我有一个popup
10 秒后显示的模式。但它显示在页面顶部,我希望它应该显示在页脚上方的页面底部。
我怎样才能做到这一点?
这是我的代码:
// Get the modal
var modal = document.getElementById('myModal');
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close2")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user …
Run Code Online (Sandbox Code Playgroud)我的页面上有一个 UL,用作导航。在我的页脚中,我有一些 jQuery 代码,因此当我单击链接时,它会删除 li 上的活动类,然后将其放置在已单击的当前 li 上。当我单击时,这是有效的,但是当页面重新加载时,活动类将返回到前一个 li。
这是我的代码
jQuery(document).ready(function () {
"use strict";
// Init Demo JS
Demo.init();
// Init Theme Core
Core.init();
$('.sidebar-menu > li').click(function (e) {
$(".active").removeClass("active");
$(this).addClass("active");
});
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul class="nav sidebar-menu">
<li class="sidebar-label pt20">Menu</li>
<li class="active">
<a href="/dashboard">
<span class="glyphicon glyphicon-home"></span>
<span class="sidebar-title">Dashboard</span>
</a>
</li>
<li>
<a href="/fixtures">
<span class="fa fa-calendar"></span>
<span class="sidebar-title">Fixtures</span>
</a>
</li>
<li>
<a href="/players">
<span class="glyphicon glyphicon-book"></span>
<span class="sidebar-title">Players</span>
</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我是否在 jQuery 中遗漏了一些东西来将类保持在所需的位置?