0
나는 navstart navbar-inverse를 사용하여 페이지에 div가 있습니다. 페이지가로드되면 사용자는 닫기 버튼을 클릭 한 다음 2 일 후에 만료되도록 쿠키를 설정합니다. 다음에 사용자가 페이지에 오면 쿠키가 만료되어 div가 숨겨집니다. 그렇지 않으면 div가 표시됩니다. 귀하의 응답을 감사하십시오.div에서 만료되도록 쿠키 설정
// 여기 div가 페이지에 다른 콘텐츠가 있습니다.
<div id="myFooter">
<div class="navbar-inverse1 navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="navbar-text pull-right">
<button type="button" class="close" id="myButton" data-dismiss="navbar">×</button>
<h1 class="text-center">Do Something Here</h1>
<p>Lorem ipsum is a pseudo-Latin text used in web design, typography, layout, and printing in place of English to emphasise design elements over content. It's also called placeholder (or filler) text. It's a convenient tool for mock-ups. It helps to outline the visual elements of a document or presentation, so to deliberately render its content nonsensical; it's not genuine, correct, or comprehensible Latin anymore. While lorem ipsum's still resembles classical Latin</p>
</div>
</div>
</div>
</div>
// 여기 스크립트가 있지만 작동하지 않습니다.
<script>
$(document).ready(function() {
// initially popup click to hide:
$('.close').click(function() {
$('#myFooter').hide();
});
// Check for the "whenToShowPopup" cookie, if not found then show the popup and save the cookie.
// The cookie will expire and every 2 days and the popup will show again.
limit = 5;
idleTime = 0;
if ($.cookie('whenToShowPopup') == null) {
function timerIncrement() {
idleTime = idleTime + 1;
if (idleTime > $limit && $.cookie('whenToShowPopup') != 'yes') {
$('#myFooter').show();
idleTime = 0;
console.log('whenToShowPopup', 'idleTime');
// Create expiring cookie, 2 days from now:
$.cookie('whenToShowPopup', 'yes', {
expires: 2,
path: '/'
});
// Show Popup
$('#myFooter').hide();
console.log('whenToShowPopup', 'cookie created');
};
});
});
</script>
감사합니다. –
코드는 오류없이 실행되지만 쿠키를 작성하는지 확신 할 수 없습니다. 그것은 어떤 console.log도하지 않았습니다. –
console.log 쿠키 또는 그 이상. (앱이 열렸을 때) 크롬을 누르고 'ctrl + shift + i'를 누르십시오. 응용 프로그램 탭과 저장소 탭으로 이동하여 쿠키 아래를보고 쿠키가 있는지 확인하십시오. :) – matt