Thứ Hai, 15 tháng 5, 2017

Tạo khung popup quảng cáo Fanpage Facebook đơn giản và đẹp



Nếu bạn đang có một Fan page Facebook và muốn quảng cáo cho người dùng tương tác đến để cập nhật những thông tin nhanh nhất từ website của bạn.


Thì việc tại một popup quảng cáo face khi người dùng truy cập vào Blog là một điều rất cần thiết.
Ưu điểm của tiện ích popup like fanpage facebook mà Blog Tho Android sẽ giới thiệu:
  - Tiện ích này chỉ hiện thị 1 lần duy nhất khi truy cập vào trang với 1 địa chỉ ID. Điều này không gây phiền đối với người vào xem Blog của bạn.
  - Tiện ích không cần phải chèn vào đụng vào Chỉnh sửa chủ đề của Blog.

+Bước 1: Bạn vào https://www.blogger.com, vào Bố cục, nhấp chọn thêm tiện ích HTML/JavaScript.

  Sao chép và dán đoạn code sau:

<style>
#fbox-background {
    display: none;
    background: rgba(0,0,0,0.8);
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;
}
#fbox-close {
    width: 100%;
    height: 100%;
}
#fbox-display {
    background: #eaeaea;
    border: 5px solid #3a5795;
    width: 340px;
    height: 230px;
    position: absolute;
    top: 32%;
    left: 37%;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
}
#fbox-button {
    float: right;
    cursor: pointer;
    position: absolute;
    right: 0px;
    top: 0px;
}
#fbox-button:before {
    content: "CLOSE";
    padding: 5px 8px;
    background: #3a5795;
    color: #eaeaea;
    font-weight: bold;
    font-size: 10px;
    font-family: Tahoma;
}
#fbox-link,#fbox-link a.visited,#fbox-link a,#fbox-link a:hover {
    color: #000000;
    font-size: 9px;
    text-decoration: none;
    text-align: center;
    padding: 5px;
}
</style>
<script type='text/javascript'>
//<![CDATA[
jQuery.cookie = function (key, value, options) {
// key and at least value given, set 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(''));
}
// key and possibly options given, get 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'){
$('#fbox-background').delay(5000).fadeIn('medium');
$('#fbox-button, #fbox-close').click(function(){
$('#fbox-background').stop().fadeOut('medium');
});
}
$.cookie('popup_facebook_box', 'yes', { path: '/', expires: 7 });
});
</script>
<div id='fbox-background'>
<div id='fbox-close'>
</div>
<div id='fbox-display'>
<div id='fbox-button'>
</div>
<iframe allowtransparency='true' frameborder='0' scrolling='no' src='//www.facebook.com/plugins/likebox.php?
href=https://www.facebook.com/thoandroid.vn/&width=330&height=217&colorscheme=light&show_faces=true&show_border=false&stream=false&header=false'
style='border: none; overflow: hidden; background: #fff; width: 330px; height: 200px;'></iframe>
<div id="fbox-link">Like Fanpage<a style="padding-left: 0px;" href="https://thoandroid.blogspot.com/" rel="nofollow"> Hoang Tho Blog</a></div>
</div>
</div>
+Bước 2: Tìm và thay thế địa chỉ Face sau: https://www.facebook.com/thoandroid.vn
thành địa chỉ face của bạn. 
Thay đổi kích thước khung với các chữ màu đỏ đã tô.

Lưu lại và kiểm tra thành quả nhé !

   Cảm ơn các bạn đã xem bài viết. Mọi thắc mắc liên quan các bạn vui lòng comment bên dưới để trao đổi nhé !
 ( Lưu ý khi sao chép vui lòng ghi rõ nguồn trang thoandroid.ga).

Tác giả:
Trót yêu nhau từ thời mộng mơ, tựa vần thơ ghi vào trang vở
Thuở ban sơ thẹn thùng thương nhớ bằng tất cả ngây thơ...

Không có nhận xét nào: