Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. var midleTopSection = function () {
  2.  
  3. var $textDoomObj = $("#top-section").find("#text");
  4. var top = $("#top-section").height() / 2 - $textDoomObj.height() / 2;
  5. var left = $("#top-section").width() / 2 - $textDoomObj.width() / 2;
  6. if ($(document).width() > 742) {
  7. top -= 100;
  8. }
  9. var windowLeft = $("#top-section").width() / 2 - $("#desccription").find("#window").width() / 2;
  10.  
  11. $textDoomObj.css({
  12. "top": top,
  13. "left": left
  14. });
  15.  
  16. $("#desccription").find("#window").css({
  17. "left": windowLeft
  18. });
  19.  
  20.  
  21. };
  22.  
  23. $(function () {
  24.  
  25. midleTopSection();
  26.  
  27. var canvasDiv = document.getElementById('particle-canvas');
  28.  
  29. var options = {
  30. particleColor: '#888',
  31. interactive: true,
  32. speed: 'medium',
  33. density: 'high',
  34. background: "img/bg.png"
  35. };
  36.  
  37. var particleCanvas = new ParticleNetwork(canvasDiv, options);
  38.  
  39.  
  40. });
  41.  
  42. $(window).on("resize", function () {
  43. midleTopSection();
  44. });
  45.  
  46. $(window).on("scroll", function () {
  47.  
  48. var scroll = $(document).scrollTop();
  49.  
  50. if (scroll > 50) {
  51.  
  52. $("header").removeClass("start");
  53. $("header").css({
  54. "top": "0",
  55. "position": "fixed"
  56. });
  57. $("header").addClass("hoverable");
  58.  
  59. } else {
  60.  
  61. $("header").addClass("start");
  62. $("header").css({
  63. "top": "30px",
  64. "position": "absolute"
  65. })
  66. $("header").removeClass("hoverable");
  67.  
  68. }
  69.  
  70. if (
  71. scroll > 50 && scroll <= $("#top-section").height()
  72. ) {
  73. $("#header-about").find(".text").css("top", "0");
  74. } else {
  75. $("#header-about").find(".text").css("top", "");
  76. }
  77.  
  78.  
  79. if (
  80. scroll > $("#top-section").height() && scroll <= $("#top-section").height() + $("#team").height()
  81. ) {
  82. $("#header-team .text").css("top", "0");
  83. } else {
  84. $("#header-team .text").css("top", "");
  85. }
  86.  
  87. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement