function setCookie(key, value, expires) { var cookieStr = key + "=" + value; if (expires) { cookieStr += "; " + "max-age" + "=" + 1; } document.cookie = cookieStr;}function getCookie(sName) { var aCookie = document.cookie.split("; "); for (var i = 0; i < aCookie.length; i++) { var aCrumb = aCookie[i].split("="); if (sName == aCrumb[0]) return unescape(aCrumb[1]); } return null;}$(function(){var act = getCookie('act'); //从海报到抽奖 if (act == 'freshen') { $('.loader-container,.p1,.p2,.p3').addClass('none') swiperInit() } else { $('.p1,.p2,.p3,.loader-container').removeClass('none') } $('.btn-goLottery').on('click', function () { var exp = new Date(); exp.setTime(exp.getTime() + 1000); exp = exp.toGMTString(); setCookie("act", "freshen", exp); window.location.href = url + '/default/index' });}) 现在是这样的 我点击去抽奖存储cookie 跳转 取cookie判断在值显示隐藏页面某部分但是现在会有在真机上偶尔失效的情况 直接就是刷新没有隐藏想要隐藏的部分
添加回答
举报
0/150
提交
取消