I have created a new rails app and installed all the necessary gems. Added all the files. Updated the application.js file. Everything works but for some reason all the javas
The tricky part is around the welcomes.js
and the turbolinks.
Convert your welcomes.js
to coffee (with js2coffee for example) and then copy it in a file like home.coffee
on your app/assets/javascripts
.
The key is at the first line to add $(document).on "turbolinks:load", ->
$(document).on "turbolinks:load", ->
(($) ->
'use strict'
# Start of use strict
# jQuery for page scrolling feature - requires jQuery Easing plugin
$('a.page-scroll').bind 'click', (event) ->
$anchor = $(this)
$('html, body').stop().animate { scrollTop: $($anchor.attr('href')).offset().top - 50 }, 1250, 'easeInOutExpo'
event.preventDefault()
return
# Highlight the top nav as scrolling occurs
$('body').scrollspy
target: '.navbar-fixed-top'
offset: 51
# Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click ->
$('.navbar-toggle:visible').click()
return
# Offset for Main Navigation
$('#mainNav').affix offset: top: 100
# Initialize and Configure Scroll Reveal Animation
window.sr = ScrollReveal()
sr.reveal '.sr-icons', {
duration: 600
scale: 0.3
distance: '0px'
}, 200
sr.reveal '.sr-button',
duration: 1000
delay: 200
sr.reveal '.sr-contact', {
duration: 600
scale: 0.3
distance: '0px'
}, 300
# Initialize and Configure Magnific Popup Lightbox Plugin
$('.popup-gallery').magnificPopup
delegate: 'a'
type: 'image'
tLoading: 'Loading image #%curr%...'
mainClass: 'mfp-img-mobile'
gallery:
enabled: true
navigateByImgClick: true
preload: [
0
1
]
image: tError: 'The image #%curr% could not be loaded.'
return
) jQuery
and everything works fine! Don't change anything else. Setup your js manifest with the correct js files for your template and you're ready.