Added Grunt.js to compile SASS and CoffeeScript assets; copied over styles and scripts from Hugo project
This commit is contained in:
15
assets/coffee/varrock.coffee
Normal file
15
assets/coffee/varrock.coffee
Normal file
@ -0,0 +1,15 @@
|
||||
$(window).scroll ->
|
||||
wScroll = $(this).scrollTop()
|
||||
|
||||
# Header parallax
|
||||
$('#header-logo').css('transform', 'translate(-50%, ' + (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)')
|
Reference in New Issue
Block a user