這次帶給大家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();
相信看了本文案例你已經掌握了方法,更多精彩請關注php中文網其它相關文章!
推薦閱讀:
以上是jQuery做出玻璃質感手風琴特效步驟詳解(附程式碼)的詳細內容。更多資訊請關注PHP中文網其他相關文章!