jQuery三维倾斜的滚动效果js代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 jQuery三维倾斜的滚动效果js代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

jQuery三维倾斜的滚动效果js代码

HTML代码(index.html):

<!doctype html>
<html>
<head>
	<meta charset="gb2312">
	<title>jQuery��ά��б�Ĺ���Ч��</title>
	<!--<link href='http://fonts.googleapis.com/css?family=Noto+Serif:400italic' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,700' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Pacifico:400' rel='stylesheet' type='text/css'>-->
	<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
  <script type="text/javascript" src="js/jquery.tiltedpage-scroll.js"></script>
  <link href='css/tiltedpage-scroll.css' rel='stylesheet' type='text/css'>
  <style>
    html {
      height: 100%;
    }
    body {
      background: #F1f1f2;
      padding: 0;
      text-align: center;
      font-family: 'open sans';
      position: relative;
      margin: 0;
      height: 100%;
    }
    
    .wrapper {
    	height: auto !important;
    	height: 100%;
    	margin: 0 auto; 
    	overflow: hidden;
    }
    
    a {
      text-decoration: none;
    }
    
    
    
    h1, h2 {
      width: 100%;
      float: left;
    }
    h1 {
      margin-top: 100px;
      color: #999;
      margin-bottom: 5px;
      font-size: 70px;
      font-weight: 100;
    }
    h2 {
      padding: 00px 20px 30px 20px;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      letter-spacing: 0px;
      color: #888;
      font-size: 20px;
      line-height: 160%;
      font-weight: 100;
      margin-top: 10px;
      margin-bottom: 0;
    }
    
    
    .pointer {
      color: #00B0FF;
      font-family: 'Pacifico';
      font-size: 24px;
      margin-top: 15px;
      position: absolute;
      top: 130px;
      right: -40px;
    }
    .pointer2 {
      color: #00B0FF;
      font-family: 'Pacifico';
      font-size: 24px;
      margin-top: 15px;
      position: absolute;
      top: 130px;
      left: -40px;
    }
    pre {
      margin: 80px auto;
    }
    pre code {
      padding: 35px;
      border-radius: 5px;
      font-size: 15px;
      background: rgba(0,0,0,0.1);
      border: rgba(0,0,0,0.05) 5px solid;
      max-width: 500px;
    }


    .main {
      float: left;
      width: 100%;
      margin: 0 auto;
    }
    
    
    .main h1 {
      padding:20px 50px 10px;
      float: left;
      width: 100%;
      font-size: 60px;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      font-weight: 100;
      margin: 0;
      padding-top: 55px;
      font-family: 'Open Sans';
      letter-spacing: -1px;
      text-transform: capitalize;
    }
   
    .main h1.demo1 {
      background: #1ABC9C;
    }
    
    .reload.bell {
      font-size: 12px;
      padding: 20px;
      width: 45px;
      text-align: center;
      height: 47px;
      border-radius: 50px;
      -webkit-border-radius: 50px;
      -moz-border-radius: 50px;
    }
    
    .reload.bell #notification {
      font-size: 25px;
      line-height: 140%;
    }
    
    .reload, .btn{
      display: inline-block;
      border-radius: 3px;
      -moz-border-radius: 3px;
      -webkit-border-radius: 3px;
      display: inline-block;
      line-height: 100%;
      padding: 0.7em;
      text-decoration: none;
      width: 100px;
      line-height: 140%;
      font-size: 17px;
      font-family: Open Sans;
      font-weight: bold;
      -webkit-box-shadow: none;
      box-shadow: none;
      background-color: #4D90FE;
      background-image: -webkit-linear-gradient(top,#4D90FE,#4787ED);
      background-image: -webkit-moz-gradient(top,#4D90FE,#4787ED);
      background-image: linear-gradient(top,#4d90fe,#4787ed);
      border: 1px solid #3079ED;
      color: #FFF;
    }
    .reload:hover{
      background: #317af2;
    }
    .btn {
      width: 200px;
      -webkit-box-shadow: none;
      box-shadow: none;
      background-color: #4D90FE;
      background-image: -webkit-linear-gradient(top,#4D90FE,#4787ED);
      background-image: -moz-linear-gradient(top,#4D90FE,#4787ED);
      background-image: linear-gradient(top,#4d90fe,#4787ed);
      border: 1px solid #3079ED;
      color: #FFF;
    }
    .clear {
      width: auto;
    }
    .btn:hover, .btn:hover {
      background: #317af2;
    }
    .btns {
      float: left;
      width: 100%;
      margin: 50px auto;
    }
    .credit {
      text-align: center;
      color: #888;
      padding: 10px 10px;
      margin: 0 0 0 0;
      background: #f5f5f5;
      float: left;
      width: 100%;
    }
    .credit a {
      text-decoration: none;
      font-weight: bold;
      color: black;
    }
    
    .back {
      position: absolute;
      top: 0;
      left: 0;
      text-align: center;
      display: block;
      padding: 7px;
      width: 100%;
      box-sizing: border-box;
      -moz-box-sizing: border-box;
      -webkit-box-sizing: border-box;
      background:#f5f5f5;
      font-weight: bold;
      font-size: 13px;
      color: #888;
      -webkit-transition: all 200ms ease-out;
      -moz-transition: all 200ms ease-out;
      -o-transition: all 200ms ease-out;
      transition: all 200ms ease-out;
    }
    .back:hover {
      background: #eee;
    }
    
    
    .page-container {
      float: left;
      width: 100%;
      margin: 0 auto 300px;
      position: relative;
    }
    .panorama {
      width: 100%;
      float: left;
      margin-top: -5px;
      height: 700px;
    }
    
    .panorama .credit {
      background: rgba(0,0,0,0.2);
      color: white;
      font-size: 12px;
      text-align: center;
      position: absolute;
      bottom: 0;
      right: 0;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      float: right;
    }
    
    .main {
      margin-bottom: 350px;
      overflow: hidden;
    }
    .tps-section {
      width: 100% !important;
      max-width: 1000px;
      margin: 0 auto;
      height: 500px;
    }
    
    .tps-section .tps-wrapper {
      border-radius: 5px;
    }
    .tps-section .tps-wrapper h1 {
      position: relative;
      height: 100%;
      position: absolute;
    }
    .tps-section .tps-wrapper h1 a{
      color: white;
      position: absolute;
      background: rgba(0,0,0,0.25);
      width: 100%;
      height: 100%;
      top: 0;
      padding-top: 225px;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      left: 0;
      font-weight: bold;
      text-transform: uppercase;
      letter-spacing: 4px;
      font-size: 20px;
      font-size: 14px;
      line-height: 190%;
    }
    
    .tps-section .tps-wrapper h1 a small{
      text-transform: none;
      font-style: italic;
      font-weight: 400;
      font-family: noto serif;
      letter-spacing: 1px;
      font-size: 14px;
    }
    
    .tps-section:nth-child(1n+1) .tps-wrapper {
      background: url(images/demo1.jpg) center center;
      background-size: cover;
    }
    
    .tps-section:nth-child(2n+1) .tps-wrapper {
      background:  url(images/demo2.jpg) center center;
      background-size: cover;
    }
    
    .tps-section:nth-child(3n+1) .tps-wrapper {
      background:  url(images/demo3.jpg) center center;
      background-size: cover;
    }
    
    .tps-section:nth-child(4n+1) .tps-wrapper {
      background:  url(images/demo4.jpg) center center;
      background-size: cover;
    }
    
    .header {
      overflow: hidden;
      clear: both;
    }
	</style>
	<script>
	  $(document).ready(function(){
      $(".main").tiltedpage_scroll({
        angle: 20
      });
		});
		
	  </script>
  </head>
  <body>
      <div class="wrapper">	
  	  <div class="main">
	    <div class="header">
        <h1>jQuery Tilted Page Scroll</h1>
        <h2>Create a 3D Tilted Scroll Effect with jQuery Tilted Page Scroll Plugin</h2>
  	  </div>
  	  <section class="page1">
        <div class="page_container">
          <h1><a href="#/jiaoben/" target="_blank">Travel to Sydney, Australia<br><small>Completed on 14 Feb 2014</small></a></h1>
        </div>
      </section>
  	  <section class="page2">
        <div class="page_container">
          <h1><a href="#/jiaoben/" target="_blank">Visit Uluru (Ayers Rock), Australia<br><small>Completed on 17 Feb 2014</small></a></h1>
        </div>
      </section>
  	  <section class="page3">
        <div class="page_container">
          <h1><a href="#/jiaoben/" target="_blank">Travel to ZhangJiaJie (Avatar's Mountain) in China<br><small>Completed on 20 Jan 2014</small></a></h1>
        </div>
      </section>
  	  <section class="page4">
        <div class="page_container">
          <h1><a href="#/jiaoben/" target="_blank">Ride a Camel in the Australian Outback<br><small>Completed on 17 Feb 2014</small></a></h1>
        </div>
      </section>
  	  <section class="page5">
        <div class="page_container">
          <h1><a href="#/jiaoben/" target="_blank">Travel to Sydney, Australia<br><small>Completed on 14 Feb 2014</small></a></h1>
        </div>
      </section>
  	  <section class="page6">
        <div class="page_container">
          <h1><a href="#/jiaoben/" target="_blank">Visit Uluru (Ayers Rock), Australia<br><small>Completed on 17 Feb 2014</small></a></h1>
        </div>
      </section>
  	  <section class="page7">
        <div class="page_container">
          <h1><a href="#/jiaoben/" target="_blank">Travel to ZhangJiaJie (Avatar's Mountain) in China<br><small>Completed on 20 Jan 2014</small></a></h1>
        </div>
      </section>
  	  <section class="page8">
        <div class="page_container">
          <h1><a href="#/jiaoben/" target="_blank">Ride a Camel in the Australian Outback<br><small>Completed on 17 Feb 2014</small></a></h1>
        </div>
      </section>
    </div>
  </div>
</body>
</html>









JS代码(jquery.tiltedpage-scroll.js):

/* =========================================================== * jquery-tiltedpage-scroll.js v1.2.1 * =========================================================== * Copyright 2013 Pete Rojwongsuriya. * http://www.thepetedesign.com * * Create a beautiful 3D tilted effect on scroll * with Tilted Page Scroll plugin * * https://github.com/peachananr/tiltedpage-scroll * * License:GPL v3 * * ========================================================== */
!function($){
	var defaults ={
	sectionContainer:"> section",angle:50,opacity:true,scale:true,outAnimation:true}
;
	$.fn.tiltedpage_scroll = function(options){
	var settings = $.extend({
}
,defaults,options),el = $(this);
	el.find(settings.sectionContainer).addClass("tps-section");
	el.find('.tps-section').each(function(){
	var el2 = $(this);
	el2.wrapInner("<div class='tps-wrapper'></div>");
}
);
	function isElementInViewport (el3){
	var docViewTop = $(window).scrollTop(),docViewBottom = docViewTop + $(window).height(),elemTop = el3.offset().top,elemBottom = elemTop + el3.outerHeight(true);
	return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) );
}
function elementVisibilityMayChange (el4){
	if ( isElementInViewport(el4) ){
	el4.addClass("tps-inview")}
else{
	el4.removeClass("tps-inview")}
}
$(window).on('DOMContentLoaded load resize scroll',function(){
	el.find(settings.sectionContainer).each(function(){
	elementVisibilityMayChange($(this));
}
);
	el.find('.tps-section.tps-inview > .tps-wrapper').each(function(index){
	var el2 = $(this),opacity = 0,st = $(window).scrollTop(),deg = ((el2.parent().offset().top - el2.parent().height()) - st) / $(window).height() * (settings.angle * 3),scale = ((st + $(window).height() - (el2.parent().offset().top - el2.parent().height())) / ($(window).height() ));
	if(scale > 1) scale = 1;
	if(deg < 0) deg = 0;
	if(st > el2.parent().offset().top){
	if (settings.outAnimation == false){
	opacity = 1;
	if(opacity < 0) opacity = 0;
	if (deg < 0) deg = 0;
}
else{
	opacity = ((el2.parent().offset().top + ($(window).height() * 1.2) - st)) / ($(window).height());
	opacity = Math.pow(opacity,25);
	deg = (el2.parent().offset().top - st) / $(window).height() * (settings.angle * 3);
	scale = ((st + $(window).height() - el2.parent().offset().top ) / ($(window).height() ));
}
}
else{
	if(index != 0){
	var opacity = ((st + $(window).height() - el2.parent().offset().top + (el2.height()/2))/ $(window).height());
	if(opacity > 1){
	opacity = 1;
}
}
else{
	opacity = 1;
	deg = 0;
	scale = 1;
}
}
if (settings.scale == false) scale = 1;
	if (settings.angle == false) deg = 0;
	if (settings.opacity == false) opacity = 1;
	el2.css({
	'transform':'rotateX(' + deg + 'deg) scale('+scale+','+scale+')',opacity:opacity}
);
}
);
}
);
}
}
(window.jQuery);
	

CSS代码(tiltedpage-scroll.css):

.tps-section{width:100%;height:500px;-webkit-perspective:10em;-moz-perspective:10em;-ms-perspective:10em;-o-perspective:10em;perspective:10em;-webkit-perspective-origin:center bottom;-moz-perspective-origin:center bottom;-ms-perspective-origin:center bottom;-o-perspective-origin:center bottom;perspective-origin:center bottom;-webkit-perspective-origin:50% 50%;-moz-perspective-origin:50% 50%;-ms-perspective-origin:50% 50%;-o-perspective-origin:50% 50%;perspective-origin:50% 50%;-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-ms-transform-style:preserve-3d;-o-transform-style:preserve-3d;transform-style:preserve-3d;}
.tps-wrapper{float:left;width:100%;height:100%;}
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
969.97 KB
最新结算
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
HTML5实现CSS滤镜图片切换特效代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery+css3实现信封效果
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章