开发者

Close Facebox to an event

开发者 https://www.devze.com 2023-02-16 05:05 出处:网络
Hi so when someone visits my site i would like to appear the facebox with the message \"Click [like-button] to enter or wait 20 seconds\" and when the visitor clicks the like button or the 20s are gon

Hi so when someone visits my site i would like to appear the facebox with the message "Click [like-button] to enter or wait 20 seconds" and when the visitor clicks the like button or the 20s are gone,the facebox disappear.Also the close button and click outside the box closing should be removed. This is what i tried.

 <script type="text/javascript">
   var sec = 10
var timer = setInterval(function() { 
   $('#hideMsg span').text(sec--);
   if (sec == -1) {
      $('#hideMsg').fadeOut('fast');
      clearInterval(timer);
   } 
}, 1000);
</script>
</head>
<body>
<div id="hideMsg" style="display:none;">
Click <iframe src="http://www.facebook.com/plugins/like.php?href=link&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=trebuchet+ms&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br /> 
to enter or wait <span>10</span> Seconds!
</div>
<开发者_如何学编程script type="text/javascript">
jQuery.facebox({ div: '#hideMsg' })
</script>


Download the facebox files from this repository:

https://github.com/thinknirmal/facebox

I have done significant changes to the script and so you can optionally specify not to have the regular closing options.

When initiating facebox through jQuery, do it the following way:

$.facebox({
  div       : '#content-div',
  easyClose : false
});

When you set easyClose to false, all the usual closing options are disabled (close button, escape key and clicking on the background). The default value of easyClose is true.

0

精彩评论

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

关注公众号