JavaScript手風琴頁面製作,手風琴頁面製作

來源:互聯網
上載者:User

JavaScript手風琴頁面製作,手風琴頁面製作

啥都不說了,直接上

1.Html結構代碼

<!DOCTYPE html><html> <head>  <meta charset="utf-8" />  <title>手風琴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 = 包含字型標籤寬度width

b.js中stop()方法:stop()表示結束動畫有過渡

         stop(true)表示暫停動畫,

           stop(true,true)表示立即結束動畫,無過渡

c.parent():找到上一級元素

  siblings():除了本元素外,其他的。。。

  animate():動畫效果

以上就是本文的全部內容,希望對大家的學習有所協助,也希望大家多多支援幫客之家。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.