FORGOT YOUR DETAILS?

用html css js 制作动画导航条特色效果展现cid1149+源码下载网页前端设计

html and css

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>tilt image effect</title>
    <script
  src="https://code.jquery.com/jquery-3.3.1.js"
  ></script>
    <style>
    body {
  font-family: 'Architects Daughter', sans-serif;
        margin: 0;
        padding: 0;
        overflow-y: hidden;
         
}
#paper-back {
  width: 100%;
  height: 100vh;
  background: #34495e;
  position: fixed;
  top: 0;
  left: 0;
  font-size: 33px;
}
#paper-back nav {
  padding: 120px 34px;
}
#paper-back nav a {
  display: block;
  margin-bottom: 25px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
}
#paper-window {
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow-x: hidden;
  overflow-y: hidden;
  z-index: 2;
}
#paper-window.tilt {
  overflow: hidden;
  pointer-events: none;
}
#paper-window.tilt #paper-front {
  transform: rotate(10deg) translateZ(0);
}
#paper-front {
  pointer-events: auto;
  position: relative;
  z-index: 3;
  background-image: url(oll.jpg);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
  transform-origin: center 70%;
  transition: all 0.3s ease;background-repeat: no-repeat;
     
    
}
#container section {
  height: 640px;
  text-align: center;
}
#container section:first-of-type {
  padding-top: 10vh;
}
#container section:first-of-type h1 {
  font-size: 45px;
}
#container section:first-of-type p {
  font-size: 25px;
}
@media (max-width: 600px) {
  #container section:first-of-type {
    padding-top: 15vh;
  }
  #container section:first-of-type h1 {
    font-size: 30px;
  }
  #container section:first-of-type p {
    font-size: 18px;
  }
}
 
.hamburger {
  position: fixed;
  z-index: 4;
  top: 30px;
  left: 30px;
  width: 45px;
  height: 34px;
  cursor: pointer;
  user-select: none;
}
.hamburger span {
  position: relative;
}
.hamburger span, .hamburger span:before, .hamburger span:after {
  display: block;
  width: 45px;
  height: 6px;
  background-color: #fff;
  border-radius: 2px;
}
.hamburger span:before, .hamburger span:after {
  content: '';
  position: absolute;
}
.hamburger span:before {
  bottom: -14px;
}
.hamburger span:after {
  bottom: -28px;
}
.close {
  position: fixed;
  top: 30px;
  left: 30px;
  width: 45px;
  height: 34px;
  cursor: pointer;
}
.close:before, .close:after {
  content: '';
  position: absolute;
  display: block;
  width: 45px;
  height: 6px;
  top: 50%;
  background-color: white;
  border-radius: 2px;
}
.close:before {
  transform: translateY(-50%) rotate(45deg);
}
.close:after {
  transform: translateY(-50%) rotate(-45deg);
}

    
    </style>
</head>
<body>
    <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></section>
      <section></section>
      <section></section>
    </div>
  </div>
</div>
<script>
    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 + '%');
  },
  //hamburger icon fix to keep its position
  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();
    
    
</script>
</body>
</html>

在线演示


让链接同时具备两种打开方式

获取源码: id1149
下载数:90人次, 文件大小: 106.6 KB, 上传日期: 2021年-4月-05日

公众号回复:gcode  获取解压密码

qrcode_for_gh_6ea2c28a1709_258 (1)

1,782 人查阅

获取资源构建和完善自己的源码库
源码可以在本地直接演示
同时研究和体验 如何将一些具体的想法的实现过程
源码可以直接嫁接到自己的网站里复用
稍作修改成为自己的作品
下载 (4)

您需要先支付 6元 才能查看此处内容!立即支付





 

TOP

获取源码,用于学习交流。记得 B站/点赞 /投币/转发 非常谢谢!

一键获取本站点所有源码