国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > WEB開發 > 正文

基于jQuery傾斜打開側邊欄菜單代碼

2024-04-27 15:01:20
字體:
來源:轉載
供稿:網友

基于jQuery多重圖片無限循環動畫效果。這是一款非常實用的jQuery多圖片無限循環動畫特效插件。效果圖如下:

在線預覽    源碼下載

實現的代碼。

html代碼:

<div id="paper-back">       <nav>           <div class="close"></div>           <a href="#">Home</a>           <a href="#">About Us</a>           <a href="#">Our Work</a>           <a href="#">Contact</a>       </nav>   </div>   <div id="paper-window">       <div id="paper-front">           <div class="hamburger"><span></span></div>           <div id="container">               <section>                   <p>點擊左上角的按鈕打開菜單</p>                   <p>適用瀏覽器:360、Firefox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. <br>不支持IE8及以下瀏覽器。</p>                   <p>                   <script src="/scripts/2bc/_gg_980_90.js" type="text/javascript"></script></p>               </section>               <section></section>           </div>       </div>   </div>

js代碼:

var paperMenu = {          $window: $('#paper-window'),          $paperFront: $('#paper-front'),          $hamburger: $('.hamburger'),          offset: 1800,          pageHeight: $('#paper-front').outerHeight(),          open: function () {              this.$window.addClass('tilt');              this.$hamburger.off('click');              $('#container, .hamburger').on('click', this.close.bind(this));              this.hamburgerFix(true);              // console.log('opening...');          },          close: function () {              this.$window.removeClass('tilt');              $('#container, .hamburger').off('click');              this.$hamburger.on('click', this.open.bind(this));              this.hamburgerFix(false);              // console.log('closing...');          },          updateTransformOrigin: function () {              scrollTop = this.$window.scrollTop();              equation = (scrollTop + this.offset) / this.pageHeight * 100;              this.$paperFront.CSS('transform-origin', 'center ' + equation + '%');          },          hamburgerFix: function (opening) {              if (opening) {                  $('.hamburger').css({                      position: 'absolute',                      top: this.$window.scrollTop() + 30 + 'px'                  });              } else {                  setTimeout(function () {                      $('.hamburger').css({                          position: 'fixed',                          top: '30px'                      });                  }, 300);              }          },          bindEvents: function () {              this.$hamburger.on('click', this.open.bind(this));              $('.close').on('click', this.close.bind(this));              this.$window.on('scroll', this.updateTransformOrigin.bind(this));          },          init: function () {              this.bindEvents();              this.updateTransformOrigin();          }      };      paperMenu.init();

via:http://www.w2bc.com/article/jquery-left-lean-nav


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 云龙县| 陕西省| 乳山市| 达尔| 齐齐哈尔市| 河池市| 泸水县| 宣化县| 大埔区| 阳城县| 邵阳县| 顺义区| 新巴尔虎右旗| 庄河市| 额敏县| 沙雅县| 墨竹工卡县| 阜宁县| 景东| 收藏| 万年县| 日照市| 五家渠市| 周至县| 江城| 定远县| 兴安县| 门头沟区| 平乡县| 信阳市| 宜君县| 尼玛县| 黄平县| 广丰县| 万宁市| 宿松县| 仁化县| 从江县| 宁夏| 河东区| 桃园市|