基于jQuery倾斜打开侧边栏菜单特效代码

基于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>适用浏览器:、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. <br>不支持IE及以下浏览器。</p>
     <p>
     <script src="/scripts/bc/_gg__.js" type="text/javascript"></script></p>
    </section>
    <section></section>
   </div>
  </div>
 </div>

js代码:

var paperMenu = {
   $window: $('#paper-window'),$paperFront: $('#paper-front'),$hamburger: $('.hamburger'),offset:,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 * ;
    this.$paperFront.css('transform-origin','center ' + equation + '%');
   },hamburgerFix: function (opening) {
    if (opening) {
     $('.hamburger').css({
      position: 'absolute',top: this.$window.scrollTop() + + 'px'
     });
    } else {
     setTimeout(function () {
      $('.hamburger').css({
       position: 'fixed',top: 'px'
      });
     },);
    }
   },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();

相关文章

问题背景 最近小伙伴提了一个希望提高后台下拉列表可操作性的...
// n位随机数生成 function randomNum(n) { let sString = &...
HTML是HyperText Markup Language的简称,中文名称:超文本标...
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现...
JavaScript 是脚本语言,是一种解释性脚本语言(代码不进行预...
本文由葡萄城技术团队原创并首发 转载请注明出处:葡萄城官网...