[英]Turn off Splash screen after initial load
目前对于一个网站,我有index.html,about.html等。在index.html上加载了启动画面,但我不希望它在最初加载到主屏幕后再出现。 (甚至从关于页面 - >索引)
这是我的jquery:
$(document).ready(function() {
if ($(".splash").is(":visible")) {
$(".wrapper").css({"opacity":"0"});
}
$(".splash-arrow").click(function() {
$(".splash").slideUp("800", function() {
$(".wrapper").delay(100).animate({"opacity":"1.0"}, 800);
});
});
});
它连接到index.html。 有关如何解决此问题的任何建议?
如果您只想在用户首次访问index.html
时显示启动画面,则需要在某处存储该信息。 通常,这是通过LocalStorage
或Cookies
。 对于后者,github上有一个很棒的库:
请记住,Cookie会随着您提出的每个请求被发送回服务器。
示例代码:
$(document).ready(function() {
if (typeof Cookies.get("seen_splash") !== "undefined") {
// Insert code to show the splash screen here
}
// Set the cookie for 365 days.
$(".splash-arrow").on("click", function() {
Cookies.set("seen_splash", true, { expires: 365 });
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.