Moved the site over to Ruby on Rails
This commit is contained in:
3
app/javascript/application.js
Normal file
3
app/javascript/application.js
Normal file
@ -0,0 +1,3 @@
|
||||
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
||||
import "@hotwired/turbo-rails"
|
||||
import "controllers"
|
9
app/javascript/controllers/application.js
Normal file
9
app/javascript/controllers/application.js
Normal file
@ -0,0 +1,9 @@
|
||||
import { Application } from "@hotwired/stimulus"
|
||||
|
||||
const application = Application.start()
|
||||
|
||||
// Configure Stimulus development experience
|
||||
application.debug = false
|
||||
window.Stimulus = application
|
||||
|
||||
export { application }
|
11
app/javascript/controllers/index.js
Normal file
11
app/javascript/controllers/index.js
Normal file
@ -0,0 +1,11 @@
|
||||
// Import and register all your controllers from the importmap under controllers/*
|
||||
|
||||
import { application } from "controllers/application"
|
||||
|
||||
// Eager load all controllers defined in the import map under controllers/**/*_controller
|
||||
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
||||
eagerLoadControllersFrom("controllers", application)
|
||||
|
||||
// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
|
||||
// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
|
||||
// lazyLoadControllersFrom("controllers", application)
|
15
app/javascript/varrock.coffee
Normal file
15
app/javascript/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