Code
<script type="text/javascript" src="http://thuthuatso.com/jquery.js"></script>
<style type="text/css">
#floating
{
z-index: 450;
position: absolute;
width: 490px;
height: 368px;
}
#overPage
{
background: black;
z-index: 350;
position: absolute;
left: 0;
top: 0;
}
</style>
<!--Begin Adv Popup-->
<div id="ctl00_ContentPlaceHolder1_Adv_Popup_pnAdv">
<div id="overPage">
</div>
<div id="floating">
<img src="http://thegioitinhoc.vn/home/images/cover/335tc.jpg" width="490" height="360" usemap="#offline"
border="0" style="cursor: pointer" /></div>
<map name="offline">
<area shape="rect" coords="420,0,490,30" onclick="javascript:closeMe();" alt="Close"
style="cursor: pointer" />
<area shape="rect" coords="0,30,490,330" href="http://freecode.vn/for@um/archive/index.php/t-181595.html?s=0c2ecaec80f5467b45a97cf15cb3912b " target="_blank" onclick="javascript:closeMe();" style="cursor: pointer" />
</map>
<script language="javascript" type="text/javascript">
var lastScroll;
var delay = 30;
var speed = 500;
var img_w = 490;
var img_h = 360;
function centerIt() {
$("#overPage").css("width", $(window).width());
$("#overPage").css("height", $(document).height());
$("#floating").css("left", $(window).width() / 2 - img_w / 2);
$("#floating").css("top", $(window).height() / 2 - img_h / 2 + $(document).scrollTop());
}
$(document).ready(function() {
$("#overPage").css("opacity", 0.7);
$("#overPage,#floating").show();
centerIt();
});
$(window).scroll(function() {
setTimeout(function() { ani(); }, delay);
lastScroll = new Date().getTime();
});
$(window).resize(function() {
centerIt();
});
function ani() {
if ((new Date().getTime() - lastScroll) >= (delay - 20)) {
$("#floating").animate({ top: ($(window).height() / 2 - img_h / 2 + $(document).scrollTop()) }, speed);
}
}
function closeMe() {
$("#overPage,#floating").hide();
}
</script>
</div>
<!--End Adv Popup-->
Hướng dẫn:Các bạn chỉ cần đặt code vào nơi bạn thích
Lưu ý: Nếu file jquery.css không hoạt động thì các bạn có thể down lại tại đây
Nguồn bài viết: http://thegioitinhoc.vn/home....2SpvDpP
Link gốc: http://thegioitinhoc.vn