Hướng dẫn tạo POPUP quảng cáo giữa trang diễn đàn Xenforo
(Lượt xem: 9)
Hướng dẫn tạo POPUP quảng cáo giữa trang diễn đàn Xenforo. Code quảng cáo forum xenforo(Lượt xem: 9)
Demo:
<!-- --- popup ------>
<style type="text/css">
#floating
{
z-index: 9999999;
position: absolute;
width: 600px;
height: 420px;
border: 0px !important;
}
#overPage
{
background: black;
z-index: 9999999;
position: absolute;
left: 0;
top: 0;
}
</style>
<div id="ctl00_ContentPlaceHolder1_Adv_Popup_pnAdv" style="display:none">
<div id="overPage">
</div>
<div id="floating" >
<a href="javascript:closeMe();">
<div style="margin:0 auto;background:url(http://vfgen.com/images/popup/pop600x400-dkcm.jpg) no-repeat center 0;width:600px;height:400px"></div>
<!-- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" height="400" width="600">
<param name="movie" value="http://vfgen.com/images/popup/popup HCTK.swf"/>
<param name="quality" value="high"/>
<param name="wmode" value="transparent"/>
<embed src="http://vfgen.com/images/popup/popup HCTK.swf" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="400" width="600"/>
</object> -->
</a>
<p style="float: right; position: relative;top:-413px; left:14px">
<a href="javascript:closeMe();"><img src="http://vfgen.com/images/fancy_close.png"/></a>
</p>
</div>
</div>
<script language="javascript" type="text/javascript">
function opennew(){
var expire=new Date();
expire=new Date(expire.getTime()+30000);
document.cookie="VFGEN-FORUM=here; expires="+expire;
window.open('http://vfgen.com','_blank');
}
function GetCookie(name) {
var arg=name+"=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while (i<clen) {
var j=i+alen;
if (document.cookie.substring(i,j)==arg)
return "here";
i=document.cookie.indexOf(" ",i)+1;
if (i==0) break;
}
return null;
}
var visit=GetCookie("VFGEN-FORUM");
if (visit==null){
$("#ctl00_ContentPlaceHolder1_Adv_Popup_pnAdv").show();
}
var lastScroll;
var delay = 30;
var speed = 50;
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();
opennew();
}
</script><!-----------end popup---------------->
các bạn chú ý nhé:
thay link ảnh popup ở đây
<div style="margin:0 auto;background:url(http://vfgen.com/images/popup/pop600x400-dkcm.jpg) no-repeat center 0;width:600px;height:400px"></div>
thay link flash ở đây để dùng pupop flash (nhớ bỏ 2 dấu đóng đi nhé và thêm 2 dấu đóng vào cái thẻ ảnh ở trên)
<!-- <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" height="400" width="600">
<param name="movie" value="http://vfgen.com/images/popup/popup HCTK.swf"/>
<param name="quality" value="high"/>
<param name="wmode" value="transparent"/>
<embed src="http://vfgen.com/images/popup/popup HCTK.swf" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="400" width="600"/>
thời gian hiện thị lại sau mỗi lần nhấn nút close
expire=new Date(expire.getTime()+30000);
thay nút close, up ảnh đính kèm rùi thay đường dẫn
<a href="javascript:closeMe();"><img src="http://vfgen.com/images/fancy_close.png"/></a>
mỗi đoạn chèn chỗ nào vậy bạn
Trả lờiXóa