jquery實(shí)現(xiàn)滑屏大圖定時(shí)收縮為小banner圖片的廣告代碼
本文實(shí)例講述了jquery實(shí)現(xiàn)滑屏大圖定時(shí)收縮為小banner圖片的廣告代碼。分享給大家供大家參考。具體如下:
這是一款基于jQuery實(shí)現(xiàn)的JS廣告特效,滑屏大圖廣告定時(shí)收縮為小banner圖片廣告代碼,這種廣告在各大門戶網(wǎng)站現(xiàn)在還能看得到,剛打開網(wǎng)頁(yè)的時(shí)候可以看到滑下來(lái)的大圖片廣告,過(guò)一會(huì),廣告自動(dòng)縮小變成了一個(gè)banner橫幅廣告,并帶有關(guān)閉按鈕,可以關(guān)閉廣告,對(duì)于廣告來(lái)說(shuō),這個(gè)代碼挺實(shí)用。
運(yùn)行效果截圖如下:

在線演示地址如下:
http://demo.jb51.net/js/2015/jquery-scroll-big-pic-cha-style-codes/
具體代碼如下:
<!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>
<title>jQuery頂部大圖定時(shí)縮為小廣告可關(guān)閉代碼</title>
<style>
body{ margin:0; padding:0;}
img{ border:0}
.root1200{ width:1200px; height:100px; margin:0 auto; overflow:visible}
.wrapper em{ width:40px; height:15px; float:left; color:#FFF; font-size:12px; font-family:Verdana, Geneva, sans-serif;background:#333; margin:0 0 -20px 10px; padding:2px 5px 2px 10px; z-index:999; position:absolute; top:10px;}
</style>
<script language="javascript" src="jquery-1.6.2.min.js"></script>
</head>
<body>
<script type="text/javascript">
/*
* 寬窄屏切換
* */
var bigscreen = false;
if ( screen.width>=1200 ) {
bigscreen = true;
var bodyTag = document.getElementsByTagName("body")[0],
bodyClassName = bodyTag.getAttribute("className") || bodyTag.getAttribute("class");
bodyClassName = bodyClassName ? bodyClassName+" " : "";
bodyTag.className = bodyClassName+"root1200";
}
</script>
<div class="wrapper" id="snActive-wrap">
<em title="關(guān)閉廣告">Close</em>
<a target="_blank" name="redbaby_none_ggw_dt01" title="小圖" href="/"></a>
<a target="_blank" name="redbaby_none_ggw_dt01" title="大圖" href="/"></a>
</div>
<script type="text/javascript">
~function (){
var snActive = window.snActive = document.getElementById("snActive-wrap"),
a = snActive.getElementsByTagName("a"),
h = 0, w, imgSrc = [];
if (bigscreen){
w = 1190;
imgSrc[0] = "images/1390124030537_1200.jpg";// 40
imgSrc[1] = "images/1390124049068_1200.jpg";// 500
} else {
w = 990;
imgSrc[0] = "images/1390124028186.jpg";// 40
imgSrc[1] = "images/1390124043025.jpg";// 500
}
snActive.style.overflow = 'hidden';
a[0].style.display = "none";
a[0].innerHTML += '<img width="' + w + '" height="40" src="' + imgSrc[0] + '" style="display:block" />';
if(a[1]){
a[1].innerHTML += '<img width="' + w + '" height="500" src="' + imgSrc[1] + '" style="display:block" />';
}
}();
//關(guān)閉通欄廣告
var snActive = $(snActive),
hideImg = snActive.find('a:hidden'),
em = snActive.find("em");
timeout = !1;
if(hideImg[0]) {
timeout = setTimeout(function(){
snActive.animate({height:40},600,function(){
hideImg.siblings('a:visible').hide();
hideImg.show();
em.show().live("click",function(){
snActive.slideUp(300);
});
});
}, 3000)
}
</script>
<div style="text-align:center;clear:both">
</div>
</body>
</html>
希望本文所述對(duì)大家的jquery程序設(shè)計(jì)有所幫助。
- jquery實(shí)現(xiàn)兩邊飄浮可關(guān)閉的對(duì)聯(lián)廣告
- jQuery網(wǎng)頁(yè)右側(cè)廣告跟隨滾動(dòng)代碼分享
- jquery實(shí)現(xiàn)可關(guān)閉的倒計(jì)時(shí)廣告特效代碼
- jquery右下角自動(dòng)彈出可關(guān)閉的廣告層
- jQuery實(shí)現(xiàn)首頁(yè)頂部可伸縮廣告特效代碼
- jquery實(shí)現(xiàn)對(duì)聯(lián)廣告的方法
- 基于jquery實(shí)現(xiàn)的定時(shí)顯示與隱藏div廣告的實(shí)現(xiàn)代碼
- 基于jquery實(shí)現(xiàn)圖片廣告輪換效果代碼
- jQuery 浮動(dòng)廣告實(shí)現(xiàn)代碼
- jQuery實(shí)現(xiàn)頁(yè)面頂部下拉廣告
相關(guān)文章
jQuery插件FusionCharts實(shí)現(xiàn)的MSBar3D圖效果示例【附demo源碼】
這篇文章主要介紹了jQuery插件FusionCharts實(shí)現(xiàn)的MSBar3D圖效果,結(jié)合完整實(shí)例形式分析了jQuery使用FusionCharts載入xml數(shù)據(jù)繪制MSBar3D圖的相關(guān)操作技巧,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2017-03-03
基于jQuery Circlr插件實(shí)現(xiàn)產(chǎn)品圖片360度旋轉(zhuǎn)
Circlr是一款可以對(duì)產(chǎn)品圖片進(jìn)行360度全方位旋轉(zhuǎn)展示的jQuery插件,本文給大家分享一款基于jQuery Circlr插件實(shí)現(xiàn)產(chǎn)品圖片360度旋轉(zhuǎn),大家一起來(lái)看看吧2015-09-09
jquery實(shí)現(xiàn)點(diǎn)擊變換導(dǎo)航樣式的方法
這篇文章主要介紹了jquery實(shí)現(xiàn)點(diǎn)擊變換導(dǎo)航樣式的方法,可實(shí)現(xiàn)點(diǎn)擊導(dǎo)航菜單選項(xiàng)時(shí)動(dòng)態(tài)變換對(duì)應(yīng)選中項(xiàng)樣式的功能,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-08-08
jQuery.parseJSON(json)將JSON字符串轉(zhuǎn)換成js對(duì)象
本節(jié)主要介紹了使用jQuery.parseJSON(json)將JSON字符串轉(zhuǎn)換成js對(duì)象,需要的朋友可以參考下2014-07-07
jQuery使用bind函數(shù)實(shí)現(xiàn)綁定多個(gè)事件的方法
這篇文章主要介紹了jQuery使用bind函數(shù)實(shí)現(xiàn)綁定多個(gè)事件的方法,結(jié)合簡(jiǎn)單實(shí)例形式分析了jQuery使用bind函數(shù)進(jìn)行多個(gè)事件綁定的操作技巧與注意事項(xiàng),需要的朋友可以參考下2017-10-10
jQuery實(shí)現(xiàn)的縱向下拉菜單實(shí)例詳解【附demo源碼下載】
這篇文章主要介紹了jQuery實(shí)現(xiàn)的縱向下拉菜單,結(jié)合實(shí)例形式分析了jQuery動(dòng)態(tài)操作頁(yè)面元素實(shí)現(xiàn)縱向下拉菜單的步驟與相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2016-07-07
jQuery EasyUI基礎(chǔ)教程之EasyUI常用組件(推薦)
這篇文章主要介紹了jQuery EasyUI基礎(chǔ)教程之EasyUI常用組件(推薦),非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-07-07
jquery 學(xué)習(xí)之二 屬性 文本與值(text,val)
jquery 學(xué)習(xí)之二 屬性 文本與值(text,val),學(xué)習(xí)jquery的朋友可以參考下。2010-11-11

