Made the featured YouTube video links land on the page while scrolling down

This commit is contained in:
Gregory Ballantine 2021-08-21 01:44:21 -04:00
parent a688fc248c
commit 31b63accd4
2 changed files with 23 additions and 2 deletions

View File

@ -4,6 +4,15 @@
$(window).scroll -> $(window).scroll ->
wScroll = $(this).scrollTop() wScroll = $(this).scrollTop()
# Header stuff # Header parallax
$('#header-logo').css('transform', 'translate(-50%, ' + (wScroll / 2) + 'px)') $('#header-logo').css('transform', 'translate(-50%, ' + (wScroll / 2) + 'px)')
$('#header-logo h1').css('transform', 'translateY(-' + (wScroll / 2) + 'px)') $('#header-logo h1').css('transform', 'translateY(-' + (wScroll / 2) + 'px)')
# YouTube section parallax
if not (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))
$('.youtube-section').each (i, e) ->
if wScroll >= ($(e).offset().top - $(window).height())
offset = (Math.min(0, wScroll - $(e).offset().top + $(window).height() - 500)).toFixed()
$(e).find('.video-card:first-child').css('transform': 'translate(' + offset + 'px, ' + Math.abs(offset * 0.2) + 'px)')
$(e).find('.video-card:last-child').css('transform': 'translate(' + Math.abs(offset) + 'px, ' + Math.abs(offset * 0.2) + 'px)')

View File

@ -95,10 +95,22 @@ hr
// home page styles // home page styles
.youtube-section .youtube-section
@media only screen and (min-device-width: 960px)
.row
position: relative
.video-card:nth-child(1)
transform: translate(100px, 20px)
.video-card:nth-child(2)
position: relative
z-index: 20
.video-card:nth-child(3)
transform: translate(-100px, 20px)
.video-card a .video-card a
display: block display: block
margin-bottom: 25px margin-bottom: 25px
padding: 15px 20px 0 padding: 15px 20px 0
background: white
border: 2px solid #bbb border: 2px solid #bbb
img, p img, p
@ -138,6 +150,6 @@ hr
bottom: 0 bottom: 0
width: 100% width: 100%
height: $footer-height height: $footer-height
padding-top: 25px padding-top: 35px
background: #212121 background: #212121
color: white color: white