一次性FancyBox弹出如Digg.com [英] One-time FancyBox popup like on Digg.com

查看:177
本文介绍了一次性FancyBox弹出如Digg.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何操作一个FancyBox弹出窗口,通知新用户一个快速注册按钮(或任何选择)像Digg.com ...和仅仅一次。我真的没有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.

希望能帮助别人。

这篇关于一次性FancyBox弹出如Digg.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆