jquery實現(xiàn)的Banner廣告收縮效果代碼
本文實例講述了jquery實現(xiàn)的Banner廣告收縮效果代碼。分享給大家供大家參考。具體如下:
這里演示一個Banner廣告收縮效果,點開后,網(wǎng)頁顯示大廣告,用鼠標點擊“關(guān)閉”后,廣告會收縮上去,此效果已在各大網(wǎng)站見到過,歡迎借鑒使用。
運行效果截圖如下:

在線演示地址如下:
http://demo.jb51.net/js/2015/jquery-banner-show-close-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>一個Banner廣告收縮效果</title>
<style type="text/css">
*{margin:0; padding:0;}/*為了方便 直接這樣重置了*/
#main{margin:0 auto; width:960px;}
#banner{display:none; margin:0 auto; width:960px; height:160px; background:url(images/banner.png) no-repeat; position:relative;}
#close{display:block; width:50px; height:22px; text-align:center; line-height:22px; border:1px #ddd solid; background:#000; color:#fff; font-size:12px; float:right; cursor:pointer;}
</style>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$
(
function()
{
$("#banner").slideDown();
var Up=function(){$("#banner").slideUp(1500)}
setTimeout(Up,3000);
$("#close").click
(
function()
{
$("#banner").slideToggle
(
600,function()
{
if($("#banner").css("display") == "none")
{
$("#close").text("打開");
}
else
{
$("#close").text("關(guān)閉");
}
}
);
}
);
}
);
</script>
</head>
<body>
<div id="main">
<div id="banner"></div>
<span id="close">關(guān)閉</span>
</div>
</body>
</html>
希望本文所述對大家的jquery程序設(shè)計有所幫助。
- Android UI實現(xiàn)廣告Banner輪播效果
- 手把手教你用ViewPager自定義實現(xiàn)Banner輪播
- Android自動播放Banner圖片輪播效果
- jquery實現(xiàn)簡單的banner輪播效果【實例】
- 簡單的jQuery banner圖片輪播實例代碼
- Android實現(xiàn)Banner界面廣告圖片循環(huán)輪播(包括實現(xiàn)手動滑動循環(huán))
- jquery實現(xiàn)滑屏大圖定時收縮為小banner圖片的廣告代碼
- jQuery+css3動畫屬性制作獵豹瀏覽器寬屏banner焦點圖
- 運用jQuery定時器的原理實現(xiàn)banner圖片切換
- jquery Banner輪播選項卡
相關(guān)文章
jquery實現(xiàn)導(dǎo)航固定頂部的效果仿蘑菇街
這篇文章主要介紹了jquery實現(xiàn)導(dǎo)航固定頂部的效果,仿蘑菇街的,感覺還不錯,下面將實例與大家分享下2014-10-10
jQuery插件原來如此簡單 jQuery插件的機制及實戰(zhàn)
這種插件是將對象方法封裝起來,用于對通過選擇器獲取的jQuery對象進行操作,是最常見的一種插件2012-02-02
Spring MVC中Ajax實現(xiàn)二級聯(lián)動的簡單實例
下面小編就為大家?guī)硪黄猄pring MVC中Ajax實現(xiàn)二級聯(lián)動的簡單實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-07-07
基于JQuery和DWR實現(xiàn)異步數(shù)據(jù)傳遞
這篇文章主要介紹了基于JQuery和DWR實現(xiàn)異步數(shù)據(jù)傳遞,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者工作具有一定的參考學(xué)習價值,需要的朋友可以參考下2020-10-10

