Load skrollr.init the right way in Rails

Asked

Viewed 33 times

0

I’m using the Skrollr in an application Rails as follows:

Gem Utilizado:

gem 'skrollr-rails'

app/Assets/Javascripts/application.js

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap
//= require skrollr
//= require skrollr.menu
$(document).on("ready page:load", function () {
    var s = skrollr.init({
        smoothScrolling: false,
        mobileDeceleration: 0.004
    });

    skrollr.menu.init(s, {
        animate: true,
        scale: 2
    });
});

I have a main page where I have a layout Parallax and a few other pages detailing some products and services.

The problem:

Init is made in "ready page:load", however while navigating between pages it stops working again only if I give a refresh on the page. What can be done?

1 answer

0


This being loaded correctly, to work just add the code as below:

// => skrollr.init()
s.refresh();

Thus the Skrollr will be reloading page elements.

Official documentation

Browser other questions tagged

You are not signed in. Login or sign up in order to post.