Php 使用JQuery消失div-如何防止下次打开页面时重新加载div
我有一个Php 使用JQuery消失div-如何防止下次打开页面时重新加载div,php,jquery,html,css,wordpress,Php,Jquery,Html,Css,Wordpress,我有一个div,它使用jquery+css消失了。它工作得很好,但我遇到了一个问题。我如何让div在下次用户在同一wordpress站点上打开页面时不重新加载。由于div存在于header.php中,因此每次调用新页面时,div也会被调用,即使用户之前已将其删除 有没有办法确保使用现有的基础设施,每次访问只加载一次横幅?我觉得一定有办法做到这一点,特别是因为wordpress是在php上运行的,但我有点不知所措 这是我目前正在编辑的,下面是与横幅相关的代码 HTML: <div id="g
div
,它使用jquery+css消失了。它工作得很好,但我遇到了一个问题。我如何让div
在下次用户在同一wordpress站点上打开页面时不重新加载。由于div
存在于header.php
中,因此每次调用新页面时,div
也会被调用,即使用户之前已将其删除
有没有办法确保使用现有的基础设施,每次访问只加载一次横幅?我觉得一定有办法做到这一点,特别是因为wordpress是在php上运行的,但我有点不知所措
这是我目前正在编辑的,下面是与横幅相关的代码
HTML:
<div id="greenbanner">
<img src="<?php bloginfo('template_directory'); ?>/Devices.png" id="devices">
<img src="<?php bloginfo('template_directory'); ?>/bigx.png" id="bigx">
<div id="bannertext">Spundge lets you discover, <br />curate, and create better content. <br /><br />
<div id="jointhedarkside"><a style="color:#ffffff;" href="https://www.spundge.com/account/signup/">Get Started - It's Free</a></div>
</div>
</div>
CSS:
您设置了一个cookie,如果找到了,甚至可能不会在PHP中呈现该框。您设置了一个cookie,如果找到了,甚至可能不会在PHP中呈现该框。您可以在javascript中使用cookie功能来实现此目的。存储一个表示div状态的值。每次加载页面时检查 为此,可以在javascript中使用cookie功能。存储一个表示div状态的值。每次加载页面时检查 最简单的方法可能是使用cookies。@Mike实现这一点的最佳方法是什么?最简单的方法可能是使用cookies。@Mike实现这一点的最佳方法是什么?
$(document).ready(function(){
$("#headershadow").hide();
$("#bigx").click(function(){
$("#greenbanner").hide(1000);
$("#headershadow").show();
});
});
#greenbanner {
width: 100%;
height: 200px;
background-color: #ffffff;
background: rgba(248,80,50,1);
background: -moz-linear-gradient(top, rgba(248,80,50,1) 0%, rgba(82,133,48,1) 0%, rgba(241,111,92,1) 0%, rgba(82,133,48,1) 0%, rgba(87,219,0,1) 0%, rgba(76,140,30,1) 83%, rgba(76,140,30,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(248,80,50,1)), color-stop(0%, rgba(82,133,48,1)), color-stop(0%, rgba(241,111,92,1)), color-stop(0%, rgba(82,133,48,1)), color-stop(0%, rgba(87,219,0,1)), color-stop(83%, rgba(76,140,30,1)), color-stop(100%, rgba(76,140,30,1)));
background: -webkit-linear-gradient(top, rgba(248,80,50,1) 0%, rgba(82,133,48,1) 0%, rgba(241,111,92,1) 0%, rgba(82,133,48,1) 0%, rgba(87,219,0,1) 0%, rgba(76,140,30,1) 83%, rgba(76,140,30,1) 100%);
background: -o-linear-gradient(top, rgba(248,80,50,1) 0%, rgba(82,133,48,1) 0%, rgba(241,111,92,1) 0%, rgba(82,133,48,1) 0%, rgba(87,219,0,1) 0%, rgba(76,140,30,1) 83%, rgba(76,140,30,1) 100%);
background: -ms-linear-gradient(top, rgba(248,80,50,1) 0%, rgba(82,133,48,1) 0%, rgba(241,111,92,1) 0%, rgba(82,133,48,1) 0%, rgba(87,219,0,1) 0%, rgba(76,140,30,1) 83%, rgba(76,140,30,1) 100%);
background: linear-gradient(to bottom, rgba(248,80,50,1) 0%, rgba(82,133,48,1) 0%, rgba(241,111,92,1) 0%, rgba(82,133,48,1) 0%, rgba(87,219,0,1) 0%, rgba(76,140,30,1) 83%, rgba(76,140,30,1) 100%);
margin-top: 5px;
}
#devices {
height: 200px;
margin-left: 5%;
}
#bigx {
float: right;
margin-bottom: 260px;
margin-top: 10px;
margin-right: 20px;
}
#bigx:hover {
opacity: 0.4;
filter:alpha(opacity=40);
cursor: pointer;
}
#jointhedarkside {
font-family: Geogrotesque, Lucida Sans Unicode, sans-serif;
font-weight: 500;
color: #ffffff;
background-color: #57db00;
border-radius: 5px;
padding-top: 10px;
padding-bottom: 10px;
padding-right: 10px;
padding-left: 10px;
font-size: 18px;
letter-spacing: normal;
text-transform: uppercase;
display: block;
float: left;
line-height: 17px;
}
#jointhedarkside:hover {
cursor: pointer;
background-color: #46ab00;
}
#bannertext {
font-family: Geogrotesque, Lucida Sans Unicode, sans-serif;
font-weight: 100;
color: #ffffff;
padding-top: 50px;
margin-left: 80px;
padding-right: 25px;
padding-left: 5px;
font-size: 30px;
letter-spacing: normal;
text-transform: uppercase;
display: block;
float: left;
}