Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.19 KB | None | 0 0
  1. <html>
  2. <head>
  3.  
  4. <style>
  5. .svgHead {
  6. top:0;
  7. position:fixed;
  8. z-index:99998;
  9. left:0;
  10. }
  11. .divBody{
  12. }
  13. </style>
  14.  
  15. <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  16.  
  17. </head>
  18. <body>
  19.  
  20. <object type="image/svg+xml" data="header0.svg" class="svgHead" id="svgHead">Your browswer does not support SVG</object>
  21.  
  22. <div id="divBody" class="divBody">
  23.  
  24. <p>This guy is a pretty intelligent programmer.</p>
  25.  
  26. <p>You should probably hire him.</p>
  27.  
  28. <p>here<br>we<br>are<br>adding<br>some<br>space<br>for<br>reasons<br>cant<br>think<br>of<br>things<br>to<br>type<br>but<br>thats<br>ok<br>yeah<br>fine</p>
  29.  
  30. <span id="result">&nbsp;</span>
  31.  
  32. <p>here<br>we<br>are<br>adding<br>some<br>space<br>for<br>reasons<br>cant<br>think<br>of<br>things<br>to<br>type<br>but<br>thats<br>ok<br>yeah<br>fine</p>
  33.  
  34. <p>here<br>we<br>are<br>adding<br>some<br>space<br>for<br>reasons<br>cant<br>think<br>of<br>things<br>to<br>type<br>but<br>thats<br>ok<br>yeah<br>fine</p>
  35.  
  36. <p>here<br>we<br>are<br>adding<br>some<br>space<br>for<br>reasons<br>cant<br>think<br>of<br>things<br>to<br>type<br>but<br>thats<br>ok<br>yeah<br>fine</p>
  37.  
  38.  
  39. </div>
  40.  
  41. <script>
  42. var windowHeight=$(window).height();
  43. var origHeight=windowHeight*0.2;
  44. var currHeight=origHeight;
  45. var windowWidth=$(window).width();
  46. $("#svgHead").height(currHeight);
  47. $("#svgHead").width(windowWidth);
  48. $("#divBody").css("margin-top",currHeight);
  49.  
  50. $("#result").html("currHeight = "+currHeight);
  51.  
  52. var lastScrollTop = 0;
  53. $(window).scroll(function(event){
  54.    var st = $(this).scrollTop();
  55.    if (st > lastScrollTop){
  56.       // downscroll code
  57.       currHeight=currHeight-(windowHeight/500);
  58.       $("#svgHead").height(currHeight);
  59.       svgBottom=$("#svgHead").position().top+$("svgHead").outerHeight(true);
  60.       $("#divBody").css("margin-top",currHeight);
  61. $("#result").html("currHeight = "+currHeight);
  62.    } else {
  63.       // upscroll code
  64.       currHeight=currHeight+(windowHeight/500);
  65.       $("#svgHead").height(currHeight);
  66.       svgBottom=$("#svgHead").position().top+$("svgHead").outerHeight(true);
  67.       $("#divBody").css("margin-top",currHeight);
  68. $("#result").html("currHeight = "+currHeight);
  69.      
  70.    }
  71.    lastScrollTop = st;
  72. });
  73. </script>
  74.  
  75. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement