最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JS實(shí)現(xiàn)手風(fēng)琴特效

 更新時(shí)間:2020年11月08日 09:46:01   作者:花落(→)凋謝  
這篇文章主要為大家詳細(xì)介紹了JS實(shí)現(xiàn)手風(fēng)琴特效,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了JS實(shí)現(xiàn)手風(fēng)琴特效的具體代碼,供大家參考,具體內(nèi)容如下

效果圖

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>手風(fēng)琴</title>
  <link rel="stylesheet" href="index.css" rel="external nofollow" >
</head>

<body>
  <div class="wrapper">
    <ul class="wrapUl">
      <li>
        <div class="title">
          <h1>溫泉酒店</h1>
        </div>
        <div class="picBox picBox1"></div>
        <div class="decration">有誰(shuí)不愛泡溫泉?浸入霧氣蒸騰的泉水之中,把身體泡成一片茶葉,舒展輕盈。有比這更美妙的感覺嗎?</div>
      </li>
      <li>
        <div class="title">
          <h1>時(shí)尚酒店</h1>
        </div>
        <div class="picBox picBox2"></div>
        <div class="decration">浪漫,是香閨圍籠,是燈火迷離,淚眼婆裟的唯美,是楊柳岸、曉風(fēng)殘?jiān)轮械臒o(wú)語(yǔ)凝噎……</div>
      </li>
      <li>
        <div class="title">
          <h1>設(shè)計(jì)師酒店</h1>
        </div>
        <div class="picBox picBox3"></div>
        <div class="decration">前衛(wèi)的酒店設(shè)計(jì)理念,獨(dú)具魅力的風(fēng)格,優(yōu)美的自然風(fēng)光才能有這樣頂級(jí)的酒店</div>
      </li>
      <li>
        <div class="title">
          <h1>青年旅店</h1>
        </div>
        <div class="picBox picBox4"></div>
        <div class="decration">我為你煮一杯溫茶,斟一杯美酒。讓我們席地而坐,聽你的夢(mèng)想。用你的只言片語(yǔ)裝點(diǎn)我們的夢(mèng)想博物館</div>
      </li>
      <li>
        <div class="title">
          <h1>民宿客棧</h1>
        </div>
        <div class="picBox picBox5"></div>
        <div class="decration">在這里,你可以靜靜發(fā)呆,而不被人打擾;在這里,你能看見最美好的星星,能讓你找到最深的感動(dòng)</div>
      </li>
      <li>
        <div class="title">
          <h1>海島酒店</h1>
        </div>
        <div class="picBox picBox6"></div>
        <div class="decration">不想過(guò)冬,厭倦沉重,就飛去熱帶的島嶼游泳,卸下包袱,放下壓力,在這碧海藍(lán)天之中</div>
      </li>
      <li>
        <div class="title">
          <h1>海外酒店</h1>
        </div>
        <div class="picBox picBox7"></div>
        <div class="decration">因地形地質(zhì)的區(qū)別,世界各地的溫泉也千差萬(wàn)別,選擇一處適合自己的溫泉,你會(huì)忘記世界</div>
      </li>
    </ul>
  </div>
  <script src="jquery.js"></script>
  <script src="index.js"></script>
</body>
</html>

JS代碼

var oUl = $('ul'),
  oLi = $('li'),
  len = oLi.length,
  width = parseInt(oUl.css('width')),
  gw = width / len,
  ot = Math.floor((width - 400) / (len - 1));
  flag = true;
function init(){
  if(flag){
    change($(oLi[len-1]));    
  }
}
function bindEvent(){
  oLi.on('click',function(){
    change($(this));
    if(($(this).index() +1) == len){
      flag = false;
    }else{
      flag = true;      
    }
  });
  oUl.on('mouseleave',function(){
    init();
  })
}
function change(event){
  event.animate({
    'width':'400px'
  },300,'linear').siblings().animate({
    'width':ot + 'px'
  },300,'linear');
  event.find('.title').css({
    'display':'none'
  })
  event.siblings().find('.title').css({
    'display':'block'
  })
  event.find('.decration').css({
    'bottom':'0px'
  })
  event.siblings().find('.decration').css({
    'bottom':'-50px'
  })
}
init();
bindEvent();

CSS代碼

*{
  margin:0;
  padding:0;
  list-style:none;
}
body{
  background-color:#333;
}
.wrapper{
  width:80%;
  margin:50px auto;
  padding:40px;
}
.wrapper ul{
  width:100%;
  height:300px;
  overflow: hidden;
}
.wrapper ul li{
  float: left;
  width:14.2;
  height:260px;
  position:relative;
  overflow:hidden;
  cursor:pointer;  
}
.picBox{
  width:100%;
  height:100%;
}
.picBox1{
  background:url(images/1.jpg) no-repeat center 0;
}
.picBox2{
  background:url(images/2.jpg) no-repeat center 0;
}
.picBox3{
  background:url(images/3.jpg) no-repeat center 0;
}
.picBox4{
  background:url(images/4.jpg) no-repeat center 0;
}
.picBox5{
  background:url(images/5.jpg) no-repeat center 0;
}
.picBox6{
  background:url(images/6.jpg) no-repeat center 0;
}
.picBox7{
  background:url(images/7.jpg) no-repeat center 0;
}
.wrapper ul li .title{
  position:absolute;
  overflow:hidden;
  width:100%;
  height:100%;
  left:0;
  top:0;
  background:rgba(0,0,0,0.5);
}
.wrapper ul li .title h1{
  color:#fff;
  width:30px;
  margin:0 auto;
  display:block;
  font:20px;
  padding-top:30px;
  opacity:0.8;
}
.wrapper ul li .decration{
  width:400px;
  height:40px;
  padding-left:20px;
  padding-right:30px;     
  position:absolute;
  left:0; 
  bottom:-50px;
  background:rgba(0,0,0,0.3); 
  color:#FFF; 
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

和静县| 甘德县| 瓦房店市| 新密市| 石泉县| 郴州市| 屯昌县| 汾西县| 综艺| 灵宝市| 健康| 曲周县| 邯郸县| 兴安盟| 广安市| 斗六市| 山西省| 东城区| 方山县| 阳春市| 五华县| 丽水市| 奉贤区| 阿城市| 阿拉善盟| 江孜县| 炉霍县| 龙里县| 绵竹市| 呼和浩特市| 西安市| 日喀则市| 九龙县| 丰县| 昌黎县| 贺兰县| 乌鲁木齐县| 平原县| 长子县| 长沙县| 手游|