• Đăng ký
  • Đăng nhập

Khung chat đơn giản (sử dụng Messenger Facebook)

📅 — 👀 303 — 👦

Trang này có hữu ích không?

👍 Có (11)        👎 Không (9)


Đây là mã giúp bạn tạo cửa sổ bật lên "trò chuyện với tôi" qua Messenger Facebook. Mã rất đơn giản.

Result

[html]<!-- Code by ThichCode.NET -->
<button id="chatMe" onclick="ChatWithMe()" style="display: inline-block;"><i class="glyphicon glyphicon-flash"></i> Chat with me</button>
<button id="myBtn" onclick="topFunction()" title="Go to top" style="display: inline-block;"><i class="glyphicon glyphicon-arrow-up"></i></button>[/html][css]<!-- Code by ThichCode.NET -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" />
<style>
#myBtn, #chatMe {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
border: none;
outline: none;
cursor: pointer;
padding: 15px;
height: 45px;
opacity: 0.5;
background: black;
color: white;
}
#chatMe {
right: 72px;
background: rgb(8, 108, 191);
opacity: 1;
}
</style>[/css][js]<!-- Code by ThichCode.NET -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
function topFunction() {
$('html,body').animate({
scrollTop: 0
}, 700);
}

function ChatWithMe() {
var code = "https://www.facebook.com/plugins/page.php?href=https://www.facebook.com/thichcode.net&tabs=messages,timeline&width=340&height=490&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&locale=en_US";
chatwithme = window.open("", "chatwithme", 'menubar=no,location=no,resizable=no,scrollbars=no,status=no,top=100,left=500,width=370,height=500');
chatwithme.focus();
chatwithme.document.write("<iframe style='height:100%;width:100%;' src='" + code + "'/>");
}
$(window).scroll(function() {
if ($(this).scrollTop()) {
$('#myBtn,#chatMe').fadeIn();
} else {
$('#myBtn,#chatMe').fadeOut();
}
});
</script>[/js]

Trả lời


📁 Code Demo
🔖 ,