elcastro

GTA 5 Template

Dec 17th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.17 KB | None | 0 0
  1. GTA 5 Template
  2. HTML :
  3.  
  4. -----------
  5.  
  6. <div class='banner'>
  7.         <div id="parallxWrapper">
  8. <div class="parallxBackground" data-bind="attr: { style:'-webkit-transform:perspective(1000px) rotateY(' + relativeMouse.x() + 'deg) rotateX(' + relativeMouse.y() + 'deg);transform:perspective(1000px) rotateY(' + relativeMouse.x() + 'deg) rotateX(' + relativeMouse.y() + 'deg)' }">
  9.                 <div class="parallxLayerLogo"></div>
  10.                 <div class="parallxLayerRStar"></div>
  11.                 <div class="parallxLayerShooter"></div>
  12.             </div>
  13.         </div>
  14.     </div>
  15.     <div class="container" style="margin-top:60px;">
  16.         <div class="col-md-8    ">
  17.             <h2>CSS3 Parallax Demo</h2>
  18.             <p class='lead'>Knockout js too</p>
  19.         </div>
  20. </div>
  21.  
  22.  
  23. -------------------------
  24.  
  25. CSS :
  26.  
  27. ----------
  28.  
  29.         html { height:100%; }
  30.         body {
  31.             min-height: 100%;
  32.             height: auto !important;
  33.       margin:0px;
  34.         }
  35.         .banner {
  36.             background-color:  black;
  37.         }
  38.         #parallxWrapper {
  39.             margin:auto;
  40.             height:540px;
  41.             width:1000px;
  42.         }
  43.         .parallxBackground {
  44.             height:100%;
  45.             background-image:url("http://i.imgur.com/tx2ELHt.jpg");
  46.             border-radius:10px;
  47.             padding:10px;
  48.             -webkit-transform-style: preserve-3d;
  49.             transform-style: preserve-3d;
  50.         }
  51.         .parallxLayerLogo {
  52.             width:300px;
  53.             height:225px;
  54.             margin-top:50px;
  55.             margin-left:50px;
  56.             background-image:url("http://i.imgur.com/9A9KbR8.png");
  57.             position:absolute;
  58.             -webkit-transform:translateZ(90px);
  59.             -webkit-transition: all 0.2s;
  60.             transform:translateZ(90px);
  61.             transition: all 0.2s;
  62.         }
  63.         .parallxLayer:hover {
  64.             -webkit-transform:scale(1.05);
  65.             -webkit-transform:translateZ(30px);
  66.             transform:scale(1.05);
  67.             transform:translateZ(30px);
  68.             cursor:pointer;
  69.         }
  70.         .parallxLayerRStar{
  71.             width:100px;
  72.             height:90px;
  73.             margin-left:880px;
  74.             margin-top:450px;
  75.             float:right;
  76.             background-image:url("http://i.imgur.com/Mh37eRt.png");
  77.             position:absolute;
  78.             -webkit-transform:translateZ(20px);
  79.             transform:translateZ(20px);
  80.         }
  81.         .parallxLayerShooter{
  82.             width:1000px;
  83.             height:694px;
  84.             float:right;
  85.             background-image:url("http://i.imgur.com/YWCpfik.png");
  86.             position:absolute;
  87.             -webkit-transform:translateZ(50px);
  88.             transform:translateZ(50px);
  89.         }      
  90.         .parallxLayerRStar:hover {
  91.             -webkit-transform:scale(1.05);
  92.             -webkit-transform:translateZ(30px);
  93.             transform:scale(1.05);
  94.             transform:translateZ(30px);
  95.             cursor:pointer;
  96.         }
  97.  
  98.  
  99. h2, .h2 {
  100.     font-size: 30px;
  101. }
  102. h1, h2, h3 {
  103.     margin-bottom: 10px;
  104.     margin-top: 20px;
  105. }
  106.  
  107. .lead {
  108.     font-weight: 200;
  109.     line-height: 1.4;
  110.     margin-bottom: 20px;
  111. }
  112.  
  113. body {
  114.     color: #333333;
  115.     font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
  116. }
  117.  
  118. .col-md-8 {
  119.   min-height: 1px;
  120.     padding-left: 15px;
  121.     padding-right: 15px;
  122. }
  123.  
  124. -----------------------
  125.  
  126. JS :
  127.  
  128. ---------
  129.  
  130. var parallx = null;
  131. var demoCount = 0;
  132.         function Parallx() {
  133.             var self = this;
  134.             $("body").mousemove(function(e) {
  135.  
  136.                     parallax.mouseX(e.pageX);
  137.                     parallax.mouseY(e.pageY);  
  138.  
  139.             });
  140.  
  141.  
  142.             self.sensitivityMultiplier = ko.observable(0.03);
  143.             self.wrapperOffset = $('#parallxWrapper').offset();
  144.             self.wrapperCenter = {
  145.                 x:ko.computed(function() { return self.wrapperOffset.left + ($('#parallxWrapper').width()/2) }, this),
  146.                 y:ko.computed(function() { return self.wrapperOffset.top + ($('#parallxWrapper').height()/2) }, this)
  147.             };
  148.             self.mouseX = ko.observable(0);
  149.             self.mouseY = ko.observable(0);
  150.             self.relativeMouse = {
  151.                 x:ko.computed(function() { return (self.mouseX() - self.wrapperCenter.x()) * self.sensitivityMultiplier() }, this),
  152.                 y:ko.computed(function() { return ((self.mouseY() - self.wrapperCenter.y()) * -1) * self.sensitivityMultiplier()}, this)
  153.             };
  154.             self.origin = {
  155.                 x:ko.computed(function() { return ((self.mouseX())/$( window ).width()) * 100 }, this),
  156.                 y:ko.computed(function() { return ((self.mouseY())/$( window ).height()) * 100 }, this)
  157.             };
  158.         };
  159.  
  160.         $(document).ready(function() {
  161.             parallax = new Parallx();
  162.             ko.applyBindings(parallax);
  163.  
  164.             setInterval(function() {
  165.                 if(demoCount < 130){
  166.                     parallax.mouseX(parallax.mouseX() + 10);
  167.                     demoCount+=1;
  168.                 }
  169.             }, 40);
  170.  
  171.  
  172.         });
  173.  
  174. ---------------
Add Comment
Please, Sign In to add comment