怎么在Blogger加入Facebook Pop Up LikeBox


开斋节假期终于有时间为科技先锋队加入Pop Up Facebook LikeBox。在网路上有各种各样的Pop Up Likebox,然而并不是每一个都适用,还得视乎于你所使用的Blogger Template。不适合用的甚至使到你的Blogger完全变形。

这里介绍一个非常简洁容易的Facebook Pop Up Likebox,同时也适用于大多数目前网络上有的Blogger Template。


首先,进入你的Blogger Dashboard > Layout > Add a Gadget > HTML/Javascript。


把以下的HTML拷贝复制进去:
<style scoped='' type='text/css'>
#fb-fanbox {display:none;background:rgba(0,0,0,0.9);width:100%;height:100%;position:fixed;top:0;left:0;z-index:99999;-webkit-transform:translateZ(0);}
#fb-boxclose {width:100%;height:100%;-webkit-transform:translateZ(0);}
#fb-boxview {background:#fff;border:8px solid #03a9f4;width:410px;height:230px;position:absolute;top:33%;left:37%;border-radius:3px;}
#fb-closebox {float:right;cursor:pointer;position:absolute;right:-1px;top:-2px;z-index:2;}
#fb-closebox:before {content:"CLOSE";padding:5px 8px;background:#03a9f4;color:#fff;font-weight:normal;font-size:10px;font-family:inherit;}
#fb-boxlink,#fb-boxlink a.visited,#fb-boxlink a,#fb-boxlink a:hover {color:#aaaaaa;font-size:9px;text-decoration:none;text-align:center;padding:5px;}
</style>
<script type='text/javascript'>
//<![CDATA[
jQuery.cookie = function (key, value, options) {
// Pengaturan cookie
if (arguments.length > 1 && String(value) !== "[object Object]") {
options = jQuery.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Dapatkan cookie
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
//]]>
</script>
<script type='text/javascript'>
jQuery(document).ready(function($){
if($.cookie('popup_facebook_box') != 'yes'){
$('#fb-fanbox').delay(1000).fadeIn('fast');
$('#fb-closebox, #fb-boxclose').click(function(){
$('#fb-fanbox').stop().fadeOut('fast');
});
}
});
</script>
<div id='fb-fanbox'>
<div id='fb-boxclose'>
</div>
<div id='fb-boxview'>
<div id='fb-closebox'>
</div>
<iframe allowtransparency='true' frameborder='0' scrolling='no' src='//www.facebook.com/plugins/likebox.php?
href=https://www.facebook.com/kejixianfengdui&width=410&height=255&colorscheme=light&show_faces=true&show_border=false&stream=false&header=false'
style='border:none;overflow:hidden;width:410px;height:200px;'></iframe><center>
<span id="linkit"><a href="http://kejixianfengdui.blogspot.com">科技先锋队</a></span></center>
</div>
</div>
view raw facebookpopup hosted with ❤ by GitHub
然后在HTML里找https://www.facebook.com/kejixianfengdui然后换上你的Facebook URL。

如果你不要像本人的部落格那样没打开一页都PopUp Facebook Likebox而只是在第一次打开Pop Up的话,先找到以下HTML code:
$('#fb-fanbox').stop().fadeOut('fast');
});
}
view raw facebookpopup2 hosted with ❤ by GitHub
找到之后,在以上的HTML code下面加上这一段:
$.cookie('popup_facebook_box', 'yes', { path: '/', expires: 7 });
view raw facebookpopup3 hosted with ❤ by GitHub
如果你要调整Facebook Likebox什么时候Pop Up,调整delay(1000)的数据即可。

没有评论:

Blogger 提供支持.