Menu icon Foundation
data-orbit not working sometimes

I am coding a site using Ruby on Rails and Foundation 5. The code I am using for the data-orbit is below. The element works when I initially load the page or refresh it, but if I navigate from the page with the data-orbit and return, the data-orbit doesn't work. It just lists items instead of loading the slideshow and everything.

<div class="row">
  <div class="large-12 hide-for-small">
    <div id="featured" data-orbit>
      <img src="http://placehold.it/1200x500&text=Slide Image 1" alt="slide image">
      <img src="http://placehold.it/1200x500&text=Slide Image 2" alt="slide image">
      <img src="http://placehold.it/1200x500&text=Slide Image 3" alt="slide image">
    </div>
  </div>
</div>

I am using the foundation-rails gem and I am using Guard only for live-reload. Let me know if more information would help. Thanks for your assistance.

data-orbitBrokenruby on rails

I am coding a site using Ruby on Rails and Foundation 5. The code I am using for the data-orbit is below. The element works when I initially load the page or refresh it, but if I navigate from the page with the data-orbit and return, the data-orbit doesn't work. It just lists items instead of loading the slideshow and everything.

<div class="row">
  <div class="large-12 hide-for-small">
    <div id="featured" data-orbit>
      <img src="http://placehold.it/1200x500&text=Slide Image 1" alt="slide image">
      <img src="http://placehold.it/1200x500&text=Slide Image 2" alt="slide image">
      <img src="http://placehold.it/1200x500&text=Slide Image 3" alt="slide image">
    </div>
  </div>
</div>

I am using the foundation-rails gem and I am using Guard only for live-reload. Let me know if more information would help. Thanks for your assistance.

This post has been closed. No new replies can be added.

Arthur de la Rocha over 4 years ago

Hey David,

Are you using the Turbolinks gem? We used to have that gem installed on a couple of apps in the past and ran into a similar issue.

Rafi Benkual over 4 years ago

Not a rails expert but are you using Turbolinks? Have you tried disabling them and seeing?

I also read this comment about them
HTML
For those using turbolinks, you will need to modify the application layout to include all assets in the header. Foundation includes javascript in the body by default.

And if it's related, there are 2 other solutions posted here https://github.com/zurb/foundation/issues/6438

David Rhoderick over 4 years ago

I think this worked! I just tried it after removing the include for turbolinks and it seems to work. Thanks a lot Rafi!