1

I'm in a rails 3.2 app, and I'm using the gem for skroller https://github.com/Prinzhorn/skrollr

My application.js requires skroller

//= require jquery-1.9.1.min
//= require jquery_ujs
//= require jquery.numeric
//= require skrollr

...and my generated html includes the expected javascript

<script src="/assets/skrollr.js?body=1" type="text/javascript"></script>

The gem is supposed to allow you to use html5 tags to create some scrolling effects, the example one they give is

 <div data-0="background-color:rgb(255,0,0);" data-500="background-color:rgb(0,0,255);">
      WOOOT
    </div>

I placed this in the view to test it out, but even though the correct script is generating, it's simply not working and I can't figure out why

My assumption is that since it's generating, then it's nothing to do with how i setup the views or application.js... looking for any help, thanks

3
  • 1
    Does your browser's console show any errors? Do you get the correct file if you open /assets/skrollr.js?body=1 manually? Commented Mar 31, 2013 at 19:18
  • No errors, the file is also the correct one when I open it manually Commented Mar 31, 2013 at 19:28
  • Okay I think I may have foudn the problem although not a solution yet... when I looked at the web console for their example, it has a " <script type="text/javascript"> var s = skrollr.init(); </script>" whereas my html doesn't render that Commented Mar 31, 2013 at 19:32

1 Answer 1

3

You need to tell skrollr to initialize itself.

Add

<script type="text/javascript">
$(function() {
    skrollr.init();
});
</script>

somewhere after you load the external files.

There are many options available to you here too. See: https://github.com/Prinzhorn/skrollr#skrollrinitoptions

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.