让 FaceBox 只显示一次

发布于 2024-11-26 09:21:40 字数 2282 浏览 0 评论 0原文

现在我正在创建一个代码,其中 Facebox(灯箱插件)仅为每个人显示一次。但它只是不起作用

我的代码是:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<link href="http://weebuild.biz/resources/facebox/facebox.css" media="screen" rel="stylesheet" type="text/css">
<script src="http://weebuild.biz/resources/facebox/facebox.js" type="text/javascript"></script>
<script type="text/javascript"> 
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({
loadingImage : 'http://weebuild.biz/resources/facebox/loading.gif',
closeImage   : 'http://weebuild.biz/resources/facebox/closelabel.png'
      });
});
</script>
<script type="text/javascript"> 
      function getCookie(c_name){
 var i,x,y,ARRcookies=document.cookie.split(";");
 for (i=0;i<ARRcookies.length;i++){
   x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
   y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
   x=x.replace(/^\s+|\s+$/g,"");
   if (x==c_name){
     return unescape(y);
     }}}
 function setCookie(c_name,value,exdays){
 var exdate=new Date();
 exdate.setDate(exdate.getDate() + exdays);
 var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
 document.cookie=c_name + "=" + c_value;
 }
       $(document).ready(function(){
         // alert(document.cookie);
 var cookieyes=getCookie("comin223");
  if(cookieyes!==null&&cookieyes!==""){
      return false();
    }
    else{
      jQuery.facebox({ div: '#cookie_box' });
    setCookie("comin223","yes",365);
    }
  });
 </script> 
<style type="text/css">
  #whats-new p {
    margin-top:15px;
  }
  .dashed {
      border-top:1px dotted black;
    }
</style>
<div id="cookie_box" style="display:none;width:500px;"> 
  <span style="font-size:18px;font-weight:bold;">What's Coming Soon</span> 
   <div class="dashed"></div> 
  <p>We will soon have a Contact Us Button in between the Request Tool and Report Bug Button</p>
 <br>
  <p><b><span style="color:red;">NOTE: This will only show up once!</span></b></p>


</div> 

这应该做的只是显示“即将推出”框一次。问题是 Facebox 无法工作,而且看起来设置正确。

Right now I'm creating a code where the Facebox (lightbox plugin) only shows once for each person. But it its just not working

My code is:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<link href="http://weebuild.biz/resources/facebox/facebox.css" media="screen" rel="stylesheet" type="text/css">
<script src="http://weebuild.biz/resources/facebox/facebox.js" type="text/javascript"></script>
<script type="text/javascript"> 
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({
loadingImage : 'http://weebuild.biz/resources/facebox/loading.gif',
closeImage   : 'http://weebuild.biz/resources/facebox/closelabel.png'
      });
});
</script>
<script type="text/javascript"> 
      function getCookie(c_name){
 var i,x,y,ARRcookies=document.cookie.split(";");
 for (i=0;i<ARRcookies.length;i++){
   x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
   y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
   x=x.replace(/^\s+|\s+$/g,"");
   if (x==c_name){
     return unescape(y);
     }}}
 function setCookie(c_name,value,exdays){
 var exdate=new Date();
 exdate.setDate(exdate.getDate() + exdays);
 var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
 document.cookie=c_name + "=" + c_value;
 }
       $(document).ready(function(){
         // alert(document.cookie);
 var cookieyes=getCookie("comin223");
  if(cookieyes!==null&&cookieyes!==""){
      return false();
    }
    else{
      jQuery.facebox({ div: '#cookie_box' });
    setCookie("comin223","yes",365);
    }
  });
 </script> 
<style type="text/css">
  #whats-new p {
    margin-top:15px;
  }
  .dashed {
      border-top:1px dotted black;
    }
</style>
<div id="cookie_box" style="display:none;width:500px;"> 
  <span style="font-size:18px;font-weight:bold;">What's Coming Soon</span> 
   <div class="dashed"></div> 
  <p>We will soon have a Contact Us Button in between the Request Tool and Report Bug Button</p>
 <br>
  <p><b><span style="color:red;">NOTE: This will only show up once!</span></b></p>


</div> 

What this is suppose to do is only show the Coming Soon box once. The problem is the facebox is not working and it looks setup correctly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只有影子陪我不离不弃 2024-12-03 09:21:40

首先,将行更改

return false();

return false;

其次,将行更改

if(cookieyes!==null&&cookieyes!==""){

if(cookieyes!==undefined&&cookieyes!==null&&cookieyes!==""){

已排序!!!

Firstly, change line

return false();

to

return false;

Secondly, change line

if(cookieyes!==null&&cookieyes!==""){

to

if(cookieyes!==undefined&&cookieyes!==null&&cookieyes!==""){

Sorted!!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文