JavaScript手風(fēng)琴頁面制作
啥都不說了,直接上效果圖


1.Html結(jié)構(gòu)代碼
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>手風(fēng)琴2</title>
<link rel="stylesheet" type="text/css" href="css/new_file.css" rel="external nofollow" />
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/new_file.js"></script>
</head>
<body>
<div id="gs">
<div class="gs gs1">
<div class="txt">
<p class="p1">我的旅行記1我的旅行記3</p>
<p class="p2">空山之旅我的旅行記3</p>
</div>
</div>
<div class="gs gs2">
<div class="txt">
<p class="p1">我的旅行記2我的旅行記3</p>
<p class="p2">沙漠之旅我的旅行記3</p>
</div>
</div>
<div class="gs gs3">
<div class="txt">
<p class="p1">我的旅行記3我的旅行記3</p>
<p class="p2">拉沙之旅我的旅行記3</p>
</div>
</div>
<div class="gs gs4">
<div class="txt">
<p class="p1">我的旅行記4我的旅行記3</p>
<p class="p2">雪山之旅我的旅行記3</p>
</div>
</div>
</div>
</body>
</html>
2.css樣式代碼
*{
padding: 0px;
margin: 0px;
font-family: "微軟雅黑";
}
#gs {
width: 1100px;
height: 429px;
}
.gs {
width: 100px;
height: 429px;
float: left;
}
.gs4 {
width: 789px;
height: 429px;
}
.gs1 {
background: url(../img/img/1.jpg) repeat scroll top left;
}
.gs2 {
background-image: url(../img/img/2.jpg);
}
.gs3 {
background-image: url(../img/img/3.jpg);
}
.gs4 {
background-image: url(../img/img/4.jpg);
}
.txt {
width: 100px;
height: 429px;
/*margin: 15px;*/
background: rgba(0,0,0,0.5);
cursor: pointer;
}
/*.txt p {
float: left;
width: 20px;
height: 429px;
color: #fff;
font-size: 20px;
margin: 14px;
}*/
.txt p {
color: #fff;
float: left;
margin: 15px;
}
.txt .p1 {
font-size: 14px;
width: 14px;
}
.txt .p2 {
font-size: 12px;
width: 12px;
}
3.javascript代碼
$(function(){
$(".txt").mouseover(function(){
$(this).parent().stop(true).animate({"width":"789px"},500).siblings().stop(true).animate({"width":"100px"},500);
});
});
4.主要:
a.字體豎排垂直:字體大小font-size = 包含字體標(biāo)簽寬度width
b.js中stop()方法:stop()表示結(jié)束動(dòng)畫有過渡
stop(true)表示暫停動(dòng)畫,
stop(true,true)表示立即結(jié)束動(dòng)畫,無過渡
c.parent():找到上一級(jí)元素
siblings():除了本元素外,其他的。。。
animate():動(dòng)畫效果
以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- JS實(shí)現(xiàn)圖片手風(fēng)琴效果
- Agularjs妙用雙向數(shù)據(jù)綁定實(shí)現(xiàn)手風(fēng)琴效果
- Vue.js手風(fēng)琴菜單組件開發(fā)實(shí)例
- js實(shí)現(xiàn)帶三角符的手風(fēng)琴效果
- js實(shí)現(xiàn)簡單的手風(fēng)琴效果
- js以及jquery實(shí)現(xiàn)手風(fēng)琴效果
- 原生JS實(shí)現(xiàn)垂直手風(fēng)琴效果
- 原生js實(shí)現(xiàn)手風(fēng)琴功能(支持橫縱向調(diào)用)
- Html5 js實(shí)現(xiàn)手風(fēng)琴效果
- JS實(shí)現(xiàn)手風(fēng)琴特效
相關(guān)文章
JavaScript實(shí)現(xiàn)背景圖像切換3D動(dòng)畫效果示例詳解
這篇文章主要為大家介紹了JavaScript實(shí)現(xiàn)背景圖像切換3D動(dòng)畫效果示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-09-09
Google 爬蟲如何抓取 JavaScript 的內(nèi)容
我們測試了谷歌爬蟲是如何抓取 JavaScript,下面就是我們從中學(xué)習(xí)到的知識(shí),需要的朋友可以參考下2017-04-04
Lerna入門之管理TypeScript monorepo教程
這篇文章主要為大家介紹了Lerna入門之管理TypeScript monorepo教程詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-11-11
JavaScript進(jìn)制轉(zhuǎn)換實(shí)現(xiàn)方法解析
這篇文章主要介紹了JavaScript進(jìn)制轉(zhuǎn)換實(shí)現(xiàn)方法,結(jié)合實(shí)例形式分析了JavaScript進(jìn)制轉(zhuǎn)換中十進(jìn)制與其他進(jìn)制轉(zhuǎn)換、以及隨機(jī)顏色生成相關(guān)操作技巧,需要的朋友可以參考下2020-01-01
addeventlistener監(jiān)聽scroll跟touch(實(shí)例講解)
下面小編就為大家?guī)硪黄猘ddeventlistener監(jiān)聽scroll跟touch(實(shí)例講解)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-08-08
javascript頁面上使用動(dòng)態(tài)時(shí)間具體實(shí)現(xiàn)
這篇文章主要介紹了javascript在頁面上使用動(dòng)態(tài)時(shí)間實(shí)現(xiàn)示例,需要的朋友可以參考下2014-03-03
bootstrap導(dǎo)航條實(shí)現(xiàn)代碼
這篇文章主要為大家詳細(xì)介紹了bootstrap導(dǎo)航條的實(shí)現(xiàn)代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-12-12
E3 tree 1.6在Firefox下顯示問題的修復(fù)方法
tree 在Firefox下只顯示一句話,用firebug查看頁面元素觀察發(fā)現(xiàn),兩個(gè)script導(dǎo)入被一個(gè)<script>分隔開了,顯然是document.write的問題.由于Firefox對(duì)js規(guī)范的檢查比較嚴(yán)格,肯定一些字符輸出的的時(shí)候沒有轉(zhuǎn)義2013-01-01

