2011-03-12 130 views
0

嗨,所以當有人訪問我的網站我想出現面板的消息「點擊[像按鈕]進入或等待20秒」,當訪客點擊像按鈕或20秒消失了,facebox消失了。關閉按鈕並在關閉方框外點擊應該被移除。這是我的嘗試。關閉Facebox事件

<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> 

回答

0

下載從這個庫中的facebox文件:

https://github.com/thinknirmal/facebox

我所做的腳本顯著的變化,所以你可以選擇指定不具備定期休息選項。

當通過jQuery的啓動facebox,做了以下的方法:

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

當您設置easyClosefalse,所有常見的關閉選項被禁用(關閉按鈕,退出鍵並單擊背景)。默認值easyClosetrue