简体   繁体   中英

Rails Foundation Orbit is not a function

I'm trying zurb foundation framework for the first time. I would like to create a slideshow; however, I receive type error orbit is not a function.

This is my application.js file:

 //= require jquery
//= require jquery_ujs
//= require jquery.ui.core
//= require foundation
//= require active_admin
//= require contractor_validate
//= require painter_validate
//= require jquery.social.media.tabs.1.6
//= require jquery.validate.min
//= require payment
//= require the-tooltip
//= require general
//= require_self

$(document).foundation();

$(window).load(function() {
$('#featured').orbit();
});

Here is my application.css file:

  *= require active_admin
  *= require dcsmt
  *= require foundation_and_overrides
  *= require style
  *= require the-tooltip
  *= require jquery.ui.all
  *= require_self

Here's what the html/code looks like:

 <div class="large-6 columns">
        <div id="featured">
          <% count = 0 %>
          <% @slides.each do |s| %>
              <% if count == 0 %>
                  <%= image_tag s.slide_photo.url(:medium) %>
              <% else %>
                  <%= image_tag s.slide_photo.url(:medium) %>
              <% end %>
              <% count = count + 1 %>
          <% end %>
        </div>
      </div>

Please advise.

Update:

  group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
 # gem 'therubyracer', :platforms => :ruby

 gem 'uglifier', '>= 1.0.3'
 gem 'zurb-foundation', '~> 4.0.0'
 end

If you run into this problem using the rails gem follow this article:

http://foundation.zurb.com/docs/components/orbit.html

You simple have to add data-orbit to your html:

 <div data-orbit>

 </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM