Dashboard Temp Share Shortlinks Frames API

HTMLify

index.js
Views: 14 | Author: cody
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// --------------------------------------
// Parallax with lax.js
// --------------------------------------
window.onload = function() {
	lax.init()

    // Add a driver that we use to control our animations
    lax.addDriver('scrollY', function () {
      return window.scrollY
    })

    // Add animation bindings to elements
    lax.addElements('.lax', {
      scrollY: {
        translateY: [
          ["elInY", "elCenterY", "elOutY"],
          {
            375: [100, 0, 100], // Screen width < 375
            500: [100, 0, 200], // Screen width > 375 and < 500
            900: [100, 0, 350], // Screen width > 900
          },
        ]
      }
    })
}

// --------------------------------------
// Fade Out Banner Image when Scrolling Down
// --------------------------------------
$(window).scroll(() => {
  var scrollTop = $(this).scrollTop();

  $('.banner').css(
    'background', () => {
      var elementHeight = $(this).height(),
      opacity = ((1 - (elementHeight - scrollTop) / elementHeight) * 0.4) + 0.8;
      return `linear-gradient(to right bottom, rgba(13, 35, 55, 0.99), rgba(23, 45, 65, ${opacity}))`
    }
  );
});

// --------------------------------------
// Drop Down Button
// --------------------------------------

$(".btn--slideToggle").click(function() {
  $(this).next().toggle({
    duration: 1000,
    start: function() {
      jQuery(this).css('display','grid');
      }
    })
  
});

// --------------------------------------
// Skill SVGs fade-in
// --------------------------------------
const faders = document.querySelectorAll(".fade-in");

const appearOptions = {
  root: null,
  threshold: 0.2,
  rootMargin: "-50px"
};

const appearOnScroll = new IntersectionObserver((entries, appearOnScroll) => {
  entries.forEach(entry => {
    if (!entry.isIntersecting) {
      return;
    } else {
      entry.target.classList.add("appear");
      appearOnScroll.unobserve(entry.target);
    }
  })
}, appearOptions);

faders.forEach(fader => {
  appearOnScroll.observe(fader);
});