开发者

Making FaceBox only show once

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 {
 开发者_StackOverflow中文版   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.


Firstly, change line

return false();

to

return false;

Secondly, change line

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

to

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

Sorted!!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜