get*_*ing 1 javascript php codeigniter splash-screen
我已经使用jquery的fadeOut选项创建了一个启动画面.它工作正常,但问题是每次点击进入下一页时屏幕都会加载.我只在启动时需要启动画面.我想我需要使用会话或其他东西,但我无法找到解决方案.我正在使用以下脚本.
$(document).ready(function () {
$("#splashscreen").click(function () {
$("#splashscreen").fadeOut(2000);
});
});
Run Code Online (Sandbox Code Playgroud)
这应该工作:
$(document).ready(function () {
if( $.cookie('splashscreen') == null ) { // Here you are checking if cookie is existing if not you are showing a splash screen and set a cookie
$("#splashscreen").fadeIn();
$.cookie("splashscreen", 1, { expires : 10 }); // cookie is valid for 10 days
}
$("#splashscreen").click(function () {
$("#splashscreen").fadeOut(2000);
});
});
Run Code Online (Sandbox Code Playgroud)