网站上经常使用的第一次打开弹出广告特效
直接上代码
jquery.cookie.js插件路径:
https://github.com/carhartl/jquery-cookie/blob/master/jquery.cookie.js
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>弹出广告</title> <style type="text/css"> *{ padding:0px; margin:0px;} .big{ width:1000px; height:500px; margin:0px auto; background:#69F; display:none;} .small{ width:1000px; height:30px; margin:0px auto; background:#F90; display:none;} .wm{ width:1000px; height:500px; margin:0px auto;} </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script src="jquery.cookie.js"></script> </head> <body> <div class="big"></div> <div class="small"></div> <div class="wm">123</div> <script type="text/javascript"> if($(".big").length){ var cookie_adv = jQuery.cookie('cookie_adv'); if(cookie_adv==null){ jQuery.cookie('cookie_adv','1'); console.log(cookie_adv); $(".big").slideDown(5000).delay(3000).slideUp(5000),$(".small").delay(13000).slideDown(1000); }else{ if(jQuery.cookie('cookie_adv') == '1'){ $(".small").css("display","block"); $(".big").hide(); } } } </script> </body> </html>
by大烧饼制作