Search code examples
javascriptruby-on-railsrubyparallaxskrollr

Parallax not working with Rails


I'm trying to recreate this demo in my own Rails project: http://ihatetomatoes.net/demos/parallax-scroll-effect/

Files are here: http://ihatetomatoes.net/demos/parallax-scroll-effect-1302.zip

But it only shows the last slide and not scrollable. I suspect there's something wrong with loading the js files in Rails but I'm not entirely sure.

Here is my repo: https://github.com/tihuan/parallaxtest. You can clone it and run rails s to see that it's broken.

*Note that you can remove requiring js files from Welcome#index.html.erb since I already added them in application.js!

** Current application.js loading order:

//= require js/vendor/jquery-1.9.1.min
//= require js/vendor/modernizr-2.7.1.min
//= require js/skrollr
//= require js/imagesloaded
//= require js/_main
//= require_tree .

Please help!


Solution

  • It might be thaat your not loading the scripts in the right way, check modernizr config and how you need to load it into the app

    <html>
      <head>
        <title>Your Awesome App</title>
        <%= stylesheet_link_tag    :application, media: :all %>
        <%= javascript_include_tag :modernizr %>
        <%= csrf_meta_tags %>
      </head>
      <body>
      ...
        <%= javascript_include_tag :application %>
      </body>
    </html>`