基于jQuery實(shí)現(xiàn)仿百度首頁換膚背景圖片切換代碼
不多說了,先給大家展示效果圖,本文支持源碼下載哦,需要的朋友可以直接下載使用,代碼很簡(jiǎn)單哦~
![]() |
html代碼:
<a href="#">換膚</a>
<div class="heitiao"></div>
<div class="con"><img src="images/content.png" /></div>
<div class="head">
<div class="menu">
<div class="title">
<p class="p1"></p>
<p class="p2"></p>
</div>
<div class="bg">
<div class="bgcon">
<img class="big" src="images/bg0s.jpg">
<img src="images/bg1s.jpg">
<img src="images/bg2s.jpg">
<img src="images/bg3s.jpg">
<img src="images/bg4s.jpg">
<img src="images/bg5s.jpg">
<img class="big" src="images/bg6s.jpg">
<img src="images/bg7s.jpg">
<img src="images/bg8s.jpg">
<img class="last" src="images/bg9s.jpg">
<img class="last" src="images/bg10s.jpg">
<img class="last" src="images/bg11s.jpg">
</div>
<div class="bgyl">
<img src="images/yl.png">
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
var i=1;
$("a").click(function(){
$(".head").animate({height:"288px"},500);
});
$(".p2").click(function(){
$(".head").animate({height:"0px"},500);
});
$(".bgcon img").hover(function(){
i=$(this).index();
$(".bgyl").css("background",'url(images/bg'+i+'.jpg)');
$(".bgyl").css("background-size","264px 180px");
});
$(".bgcon img").click(function(){
$("body").css("background",'url(images/bg'+i+'.jpg)');
});
</script>
css代碼:
*{margin:0;padding:0}
a{color:#fff;
margin-top:10px;
display:block;
margin-left:18%;
font-size:13px;
position:absolute;
}
body{background:url(images/bg0.jpg);}
.con{width:911px;
height:317px;
margin:50px auto;}
.head{width:100%;
height:0px;
background:#fff;
position:fixed;
left:0px;
top:0px;
border-bottom:1px solid #e3e3e3;
overflow:hidden;
}
.title{width:911px;
height:45px;
margin:0px auto;}
.heitiao{width:100%;
height:35px;
background:rgba(0,0,0,0.7);
}
.menu{width:100%;
height:45px;
border-bottom:1px solid #e3e3e3;}
.p1{width:861px;
height:45px;
background:url(images/p1.png);
float:left;
cursor:pointer;}
.p2{width:50px;
height:45px;
background:url(images/sp.png);
float:right;
cursor:pointer;
}
.bg{width:911px;
height:205px;
margin:25px auto;}
.bgcon{width:590px;
height:190px;
float:left;
}
.bgcon img{width:97px;
height:59px;
display:block;
float:left;
margin-right:1px;
margin-bottom:1px;
}
.bgcon .big{width:195px;
height:119px;}
.bgcon .last{position:relative;
top:-60px;
}
.bgyl{width:264px;
height:180px;
float:right;
background:url(images/bg1s.jpg);
background-size:294px;}
以上代碼就是本文介紹基于jQuery實(shí)現(xiàn)仿百度首頁換膚背景圖片切換代碼,希望大家喜歡。
- jQuery基于cookie實(shí)現(xiàn)換膚功能實(shí)例
- jQuery實(shí)現(xiàn)的網(wǎng)頁換膚效果示例
- jQuery實(shí)現(xiàn)簡(jiǎn)單的網(wǎng)頁換膚效果示例
- Bootstrap框架結(jié)合jQuery仿百度換膚功能實(shí)例解析
- 使用jQuery實(shí)現(xiàn)Web頁面換膚功能的要點(diǎn)解析
- jQuery實(shí)現(xiàn)給頁面換膚的方法
- 基于jquery ui的alert,confirm方案(支持換膚)
- jquery cookie實(shí)現(xiàn)的簡(jiǎn)單換膚功能適合小網(wǎng)站
- jQuery之網(wǎng)頁換膚實(shí)現(xiàn)代碼
- JQuery 網(wǎng)站換膚功能實(shí)現(xiàn)代碼
- jQuery結(jié)合jQuery.cookie.js插件實(shí)現(xiàn)換膚功能示例
相關(guān)文章
jQuery的選擇器中的通配符[id^=''code'']或[name^=''code'']及jquery選擇器總結(jié)
這篇文章主要介紹了jQuery的選擇器中的通配符[id^='code']或[name^='code']及jquery選擇器總結(jié)的相關(guān)資料,需要的朋友可以參考下2015-12-12
jquery使整個(gè)div區(qū)域可以點(diǎn)擊的方法
這篇文章主要介紹了jquery使整個(gè)div區(qū)域可以點(diǎn)擊的方法,涉及jQuery操作頁面元素與鼠標(biāo)事件的技巧,需要的朋友可以參考下2015-06-06
細(xì)說瀏覽器特性檢測(cè)(2)-通用事件檢測(cè)
在上一篇中介紹了jQuery1.4版本新增的幾個(gè)瀏覽器特性檢測(cè)方案和具體的目的,本文將以事件為中心,介紹一個(gè)較為完整、通用的事件檢測(cè)方案。2010-11-11
jQuery實(shí)現(xiàn)頁面倒計(jì)時(shí)并刷新效果
頁面倒計(jì)時(shí)小編在很多網(wǎng)站都有這樣的需求,今天小編給大家分享一段jq代碼實(shí)現(xiàn)頁面倒計(jì)時(shí)并刷新效果,代碼簡(jiǎn)單易懂,非常不錯(cuò),需要的的朋友參考下2017-03-03
一款基jquery超炫的動(dòng)畫導(dǎo)航菜單可響應(yīng)單擊事件
。這款導(dǎo)航菜單,初始時(shí)頁面中間一個(gè)按鈕,單擊按鈕,菜單從左側(cè)飛入頁中。再次單擊按鈕,導(dǎo)航飛入左側(cè)消息2014-11-11
javascript/jquery實(shí)現(xiàn)點(diǎn)擊觸發(fā)事件的方法分析
這篇文章主要介紹了javascript/jquery實(shí)現(xiàn)點(diǎn)擊觸發(fā)事件的方法,結(jié)合具體實(shí)例形式分析了JavaScript與jQuery針對(duì)點(diǎn)擊按鈕觸發(fā)事件的相關(guān)實(shí)現(xiàn)與使用技巧,需要的朋友可以參考下2019-11-11
jQuery 中msgTips 頂部彈窗效果實(shí)現(xiàn)代碼
最近發(fā)現(xiàn)好多網(wǎng)站都采用頂部彈窗,并且不用用戶手動(dòng)去點(diǎn)擊確定。感覺這樣很方便用戶,下面小編把實(shí)現(xiàn)代碼分享給大家,感興趣的的朋友一起看看吧2017-08-08


