2013-05-22 1 views
0

jquery + css를 사용하여 div이 사라졌습니다. 그것은 아름답게 작동하지만 문제가 발생합니다. div가 다음에 사용자가 동일한 WordPress 사이트에서 페이지를 열 때 다시로드하지 못하게하려면 어떻게합니까? divheader.php에 있기 때문에 사용자가 이전에 해지하더라도 새 페이지가 호출 될 때마다 div이 호출됩니다.JQuery를 사용하여 사라지는 div - 다음에 페이지를 다시로드하지 못하게하는 방법

기존 인프라를 사용하여 방문 당 배너를 한 번만로드 할 수있는 방법이 있습니까? 나는 wordpress가 php에서 실행되기 때문에 이것을 할 어떤 방법이 있어야만하는 것처럼 느껴진다. 그러나 나는 나의 깊이에서 조금 벗어난다.

이것은 현재 편집중인 website이며 여기 배너에 관련된 코드가 있습니다.

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> 

JQUERY :

$(document).ready(function(){ 
$("#headershadow").hide(); 
$("#bigx").click(function(){ 
    $("#greenbanner").hide(1000); 
    $("#headershadow").show(); 
}); 
}); 

CSS : 당신은 쿠키를 설정하고, 아마 당신의 PHP의 상자를 렌더링하지 않는 게 좋을

#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; 
    } 
+6

가장 쉬운 방법은 아마도 쿠키를 사용하는 것입니다. –

+0

@Mike이를 구현하는 가장 좋은 방법은 무엇입니까? – gersande

답변

3

이 경우 발견.

0

쿠키 기능을 자바 스크립트에서 사용할 수 있습니다. div 상태를 나타내는 값을 저장하십시오. 페이지가로드 될 때마다 확인하십시오.

+1

그녀에게 코드 예제 또는 링크 참조를 제공하십시오. – DontVoteMeDown

관련 문제