Cấp bậc tác giả:

HTML

Hiện quảng cáo giữa màn hình bằng Jquery

Được viết bởi QuangIT ngày 05/09/2012 lúc 07:03 PM
Để làm được quảng cáo như link demo này, chèn đoạn code này vào trong website của bạn.
  • 0
  • 10231

Hiện quảng cáo giữa màn hình bằng Jquery

Để làm được quảng cáo như link demo này, chèn đoạn code này vào trong website của bạn.

<script type="text/javascript" src="http://phim.xixam.com/themes/default/js/jquery_1.6.4.min.js"></script>
<script type="text/javascript" src="http://phim.xixam.com/themes/default/js/jquery.cookie.js"></script>
<script type="text/javascript">

$(document).ready(function() { 

//select all the a tag with name equal to modal

//Cancel the link behavior
//e.preventDefault();
var remember_popup = $.cookie('popup_cookie1');
//Get the A tag
if(!remember_popup){
var id = '#dialog';

//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();

//Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHei ght});

//transition effect 
$('#mask').fadeIn(1000); 
$('#mask').fadeTo("slow",0.8); 

//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();

//Set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);

//transition effect
$(id).fadeIn(2000); 
}

//if close button is clicked
$('.window .close').click(function () {
//Cancel the link behavior
//e.preventDefault();

$('#mask').fadeOut(1000);
$('.window').fadeOut(1000);
}); 

//if mask is clicked
$('#mask').click(function () {
$(this).fadeOut(1000);
$('.window').fadeOut(1000);
}); 
//check cookie

});

</script>
<script type="text/javascript">
$(document).ready(function() { 
var cookie_check = 1;
$.cookie('popup_cookie1', cookie_check);
}); 
</script>

<style type="text/css">
#mask {
position:absolute;
left:0;
top:0;
z-index:9000;
background-color:#000;
display:none;
}

#boxes .window {
position:absolute;
left:0;
top:0;
width:580px;

display:none;
z-index:9999;
padding:10px;
margin-top:0px;
}

#boxes #dialog {
width:580px;
margin: 10px; 
background-color:#ffffff;
}

</style>
<div id="boxes">
<div id="dialog" class="window">

<span><table style="width:580px;" border="0" cellpadding="0" cellspacing="0" align="center">

<tr>
<td>

<a href="http://www.xemphim.phimvangvn.com" target="_blank"><img src="http://2.bp.blogspot.com/-Cz_UR4HRSuU/UEMyof033dI/AAAAAAAABdE/OX1kJ-RZOA4/s320/phimvanvn.png" width="580" height="390" alt="" border="0"></a></td>
</tr>

</table></span>

<img src="http://phim.xixam.com/themes/default/images/vi_close_button.jpg" border="0" align="right" class="close" style="margin-top:5px;cursor:pointer;" />
</div>
<div id="mask"></div>
</div>

Nguồn bài viết: Sưu tầm

BÌNH LUẬN BÀI VIẾT

Bài viết mới nhất

LIKE BOX

Bài viết được xem nhiều nhất

HỌC HTML