【发布时间】:2011-12-31 13:03:50
【问题描述】:
希望有人能指出我正确的方向。
我们正在努力改进对我们的邮件列表的订阅。当用户在 x 秒后访问我们的网站时,我想要一个面板向上滑动,要求他们注册邮件列表。
如果他们点击任何按钮(注册、关闭、不再显示),我想设置一个 cookie,以便面板不再显示。
我已经掌握了向上/向下滑动,但我是 cookie 方面的新手,不知道如何设置它,所以当设置 cookie 时,滑动动作不会再次发生。
这是我的 jQuery...
// MAILING LIST SLIDER //
// set a delay of 3 seconds before mailing list panel appears
$("#mailingListPanelSlide").delay(3000).slideDown("slow");
// set triggers to close the mailing list panel & set cookie
$("a#closeButton, p.negativeActionFormButton").click(function(){
$("div#mailingListPanelSlide").slideUp("slow");
$.cookie("mailingListPanel", "dontshow");
});
// HELP!!!! if cookie is set to collapsed, then don't perform slide down/hide panel altogether?
var mailingListPanel = $.cookie("mailingListPanel");
if (mailingListPanel == "dontshow") {
$("div#mailingListPanelSlide").css("display","none");
};
//END MAILING LIST SLIDER //
【问题讨论】: