欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

jQuery做出玻璃质感手风琴特效步骤详解(附代码)

程序员文章站 2022-05-12 11:04:08
...
这次给大家带来jQuery做出玻璃质感手风琴特效步骤详解(附代码),jQuery做出玻璃质感手风琴特效的注意事项有哪些,下面就是实战案例,一起来看一下。

效果图:

jQuery做出玻璃质感手风琴特效步骤详解(附代码)

具体代码如下:

html代码:

<section class="strips">
   <article class="stripsstrip">
     <p class="stripcontent">
       <h1 class="striptitle" data-name="Lorem">Awesome</h1>
     </p>
   </article>
   <article class="stripsstrip">
     <p class="stripcontent">
       <h1 class="striptitle" data-name="Ipsum">Words</h1>
       <p class="stripinner-text">
         <h2>Ettrics</h2>
         <script src="http://www.w2bc.com/scripts/2bc/_gg_980_90.js" type="text/javascript"></script>
         <p>
           <a href="#" target="_blank"><i class="fa fa-qq"></i></a>
         </p>
       </p>
     </p>
   </article>
   <article class="stripsstrip">
     <p class="stripcontent">
       <h1 class="striptitle" data-name="Dolor">Go</h1>
       <p class="stripinner-text">
         <h2>Ettrics</h2>
         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Officia sapiente deserunt consectetur, quod reiciendis corrupti quo ea aliquid! Repellendus numquam quo, voluptate. Suscipit soluta omnis quibusdam facilis, illo voluptates odit!</p>
         <p>
           <a href="#" target="_blank"><i class="fa fa-weibo"></i></a>
         </p>
       </p>
     </p>
   </article>
   <article class="stripsstrip">
     <p class="stripcontent">
       <h1 class="striptitle" data-name="Sit">Inside</h1>
       <p class="stripinner-text">
         <h2>Ettrics</h2>
         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Officia sapiente deserunt consectetur, quod reiciendis corrupti quo ea aliquid! Repellendus numquam quo, voluptate. Suscipit soluta omnis quibusdam facilis, illo voluptates odit!</p>
         <p>
           <a href="#" target="_blank"><i class="fa fa-weixin"></i></a>
         </p>
       </p>
     </p>
   </article>
   <article class="stripsstrip">
     <p class="stripcontent">
       <h1 class="striptitle" data-name="Amet">Here</h1>
       <p class="stripinner-text">
         <h2>Ettrics</h2>
         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Officia sapiente deserunt consectetur, quod reiciendis corrupti quo ea aliquid! Repellendus numquam quo, voluptate. Suscipit soluta omnis quibusdam facilis, illo voluptates odit!</p>
         <p>
           <a href="#" target="_blank"><i class="fa fa-leaf"></i></a>
         </p>
       </p>
     </p>
   </article>
   <i class="fa fa-close stripclose"></i>
 </section>

js代码:

      var Expand = function () {
      var tile = $('.stripsstrip');
      var tileLink = $('.stripsstrip > .stripcontent');
      var tileText = tileLink.find('.stripinner-text');
      var stripClose = $('.stripclose');
      var expanded = false;
      var open = function () {
        var tile = $(this).parent();
        if (!expanded) {
          tile.addClass('stripsstrip--expanded');
          tileText.css('transition', 'all .6s 1s cubic-bezier(0.23, 1, 0.32, 1)');
          stripClose.addClass('stripclose--show');
          stripClose.css('transition', 'all .6s 1s cubic-bezier(0.23, 1, 0.32, 1)');
          expanded = true;
        }
      };
      var close = function () {
        if (expanded) {
          tile.removeClass('stripsstrip--expanded');
          tileText.css('transition', 'all 0.15s 0 cubic-bezier(0.23, 1, 0.32, 1)');
          stripClose.removeClass('stripclose--show');
          stripClose.css('transition', 'all 0.2s 0s cubic-bezier(0.23, 1, 0.32, 1)');
          expanded = false;
        }
      };
      var bindActions = function () {
        tileLink.on('click', open);
        stripClose.on('click', close);
      };
      var init = function () {
        bindActions();
      };
      return { init: init };
    }();
    Expand.init();

相信看了本文案例你已经掌握了方法,更多精彩请关注其它相关文章!

推荐阅读:

jquery实现鼠标操作悬浮轮播效果

jquery拖拽效果实现方法

以上就是jQuery做出玻璃质感手风琴特效步骤详解(附代码)的详细内容,更多请关注其它相关文章!