Canvas 廣告加入html中

 

<div class="ADdir">關閉<br>廣告</div>
<div id="AD">
	<canvas id="canvas"  class="ADmain" width="800" height="479" style="background-color:#FFFBDF" ></canvas>
</div>

 

/* AD=========================================================*/
.AD{position: relative;height: 80px;z-index: 99;}

.ADdir{position: absolute;	top: 0px; right: 0px;
        width: 40px; height: 50px;text-align: center;
	    background: #FBAEAF; z-index: 150; cursor: pointer;
        }
canvas{display: block;  position: absolute; left: 50%; z-index: 99;
        margin-left: -500px; width: 1000px;
		border: 1px solid #000000; box-shadow: 1px 1px 10px #000;}

 

//Canvas按鈕設定
	var _IO=true;
	$('.ADdir').click(function(){
	if(_IO){
		$('.ADmain').slideUp();
		$('.ADdir').html('展開<br>廣告');
	}else{
		$('.ADmain').slideDown();
		$('.ADdir').html('關閉<br>廣告');
	}
	_IO=!_IO;
});
setTimeout(ADhide,15000);
function ADhide(){
		$('.ADmain').slideUp();
		$('.ADdir').html('展開<br>廣告');
	_IO=false;
}