问题描述
我该如何操作一个 FancyBox 弹出窗口,通知新用户一个快速注册按钮(或任何选择),就像 Digg.com 上的一样......并且与 Digg 一样只有一次.我真的没有使用 cookie 的经验,但已经在网站的其他部分运行了 FancyBox,所以基础已经存在.我要求弹出窗口出现在页面加载中.任何指针都非常高兴地收到!
How can I go about actioning a FancyBox popup that notifies new users of a quick sign-up button (or whatever is chosen) like on Digg.com ... and as with Digg just one time. I really have no experience with cookies but already have FancyBox running in other parts of the website, so the basis is already there. I require the popup to appear on page load. Any pointers very happily received!
推荐答案
我的最终解决方案使用 Reveal Modal 插件 (单击此处) 使用修改后的以下代码在页面加载时触发内联以触发",以便每三天仅显示一次弹出窗口.还记得加载 jquery.cookie.js 然后添加以下代码:
My eventual solution uses the Reveal Modal plugin (click here) to trigger inline to 'fire' on page load using the modified following code for the popup to be displayed only once every three days. Remember also to load jquery.cookie.js and then add the following code:
<script type="text/javascript">
jQuery(document).ready(function(){
if (jQuery.cookie('test_status') != '1') {
jQuery('#myModal').reveal()
jQuery('#myModal').trigger('click');
jQuery.cookie('test_status', '1', { expires: 3}); }
});
</script>
使用 FancyBox 以外的东西是原始问题的答案,因为似乎某处存在冲突,因此使用 Reveal 使这两个功能完全分开.我还应该注意,Reveal 下载中的 .css 内容已添加到我们网站的样式表中.
Using something other than FancyBox was the answer to the original question as it seemed there was a conflict somewhere, so using Reveal made the two functions completely separate. I should also note that the .css contents from the Reveal download were added to our site's stylesheet.
希望这会帮助其他人.
这篇关于像 Digg.com 上的一次性 FancyBox 弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!