Advertisement
MegaApuTurkUltra

Untitled

Oct 1st, 2014
4,899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2. $("#pagewrapper").css({'background':'url(http://i.imgur.com/ra8F49A.jpg)',"background-size":"100% auto","background-repeat": "repeat-y"}).css('perspective', '800px');
  3. $("#content").css({'transform-style': 'preserve-3d', 'transition': 'transform 0.5s', 'backface-visibility': 'hidden'});
  4. $("#topnav").css("z-index", "9999999");
  5. $("#djangobbindex").css({'background':'rgba(255, 255, 255, 0.8)', 'padding':'10px', 'border-radius':'10px'});
  6.  
  7. var t, l = (new Date()).getTime(), scrolling = false;
  8. initialAmt = 0;
  9. $(window).scroll(function(){
  10.     $("#pagewrapper").css('background-position-y', ($(document).scrollTop()*10/11)+'px');
  11.     $("#content").css('transform-origin', (($(document).width()/2))+"px "+($(document).scrollTop()+$(window).height()/2)+"px");
  12.     diff = Math.abs($(document).scrollTop()-initialAmt);
  13.     if(diff>600)$("#content").css('transform', 'rotateX(-5deg) translateZ(-50px) translateY(50px)');
  14.     var now = (new Date()).getTime();
  15.     if(now - l > 400 && !scrolling ){
  16.         $(this).trigger('scrollStart');
  17.         l = now;
  18.     }
  19.     clearTimeout(t);
  20.     t = setTimeout(function(){
  21.         if (scrolling)
  22.             $(window).trigger('scrollEnd');
  23.     }, 300);
  24. });
  25.  
  26. $(window).bind('scrollStart', function(){
  27.     scrolling = true;
  28.     initialAmt = $(document).scrollTop();
  29. });
  30.  
  31. $(window).bind('scrollEnd', function(){
  32.     scrolling = false;
  33.     initialAmt = $(document).scrollTop();
  34.     $("#content").css('transform', 'none');
  35. });
  36. window.onbeforeunload=function(){
  37.    $("#content").css('transform', 'translateZ(-50px)').animate({'opacity':'0'}, 700);
  38. };
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement