A semantic search engine for source code https://bitshift.benkurtovic.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1.2 KiB

  1. /*
  2. * @file Implements a parallax effect on the about page.
  3. */
  4. var lastVertPos = $(window).scrollTop();
  5. /*
  6. * Scroll `div#img-[1-4]` at a greater speed than the text, producing a
  7. * parallax effect.
  8. */
  9. $(window).scroll(function(e){
  10. var currVertPos = $(window).scrollTop();
  11. var delta = currVertPos - lastVertPos;
  12. $(".bg").each(function(){
  13. $(this).css("top", parseFloat($(this).css("top")) -
  14. delta * $(this).attr("speed") + "px");
  15. });
  16. lastVertPos = currVertPos;
  17. });
  18. /*
  19. * Make the dimensions of the vimeo video fluid.
  20. */
  21. (function adjustVimeoDimensions(){
  22. var iframe = $("iframe#vimeo")[0];
  23. var videoRatio = (iframe.height / iframe.width) * 100;
  24. iframe.style.position = "absolute";
  25. iframe.style.top = "0";
  26. iframe.style.left = "0";
  27. iframe.width = "100%";
  28. iframe.height = "100%";
  29. iframe.style.height = "";
  30. iframe.style.width = "";
  31. var wrap = document.createElement("div");
  32. wrap.className = "fluid-vids";
  33. wrap.style.width = "100%";
  34. wrap.style.position = "relative";
  35. wrap.style.paddingTop = videoRatio + "%";
  36. var iframeParent = iframe.parentNode;
  37. iframeParent.insertBefore(wrap, iframe);
  38. wrap.appendChild(iframe);
  39. }());