0

我正在使用一个使用大量 javascript 插件的应用程序,这可能是问题所在。我正在尝试以最基本的方式(隐藏 div)在最基本的页面(home.html.erb)上让咖啡脚本工作。Coffeescript 在应用程序的某些部分工作,但大部分都不起作用。Home.html.erb 是 static_pages 控制器的一部分。下面的代码不会隐藏 div。任何帮助,将不胜感激

static_pages.js.coffee

jQuery ->
  $("#rubyPic").hide()
  $("#heroMain").hide()

主页.html.erb

<div class="center hero-unit" id="heroMain">
    <h1>finance </h1>
    <p>
    This is the home page for the RoR 
    </p>

</div>

<div class="box closable-chat-box">
  <div class="box-content padded">

    <h3>
        Your Classes that you are a currently signed up for 
        are below: 
    </h3>
    <section id="rubyPic">
      <%= link_to image_tag("rails.png", alt: "Rails"), 'http://rubyonrails.org' %>
      <%= render 'home_courses' %>
    </section>

  </div>
 </div>

应用程序.js

//= require jquery
//= require jquery_ujs
//= require bootstrap/bootstrap
//= require courses
//= require static_pages
//= require jquery191
//= require jqueryui1102
//= require fullcalendar/fullcalendar
//= require jquery_gritter
//= require sparkline
//= require tags_input
//= require jquery_uniform
//= require jquery.icheck
//= require select2
//= require d3
//= require xcharts
//= require bootstrap-wysihtml5
//= require justgage
//= require jquery.easy-pie-chart
//= require touchTouch
//= require dataTables
//= require responsive-tables
//= require wizard/bootstrap-wizard
//= require wizard/wizard_demo
//= require validation/jquery.validationEngine-en
//= require validation/jquery.validationEngine
//= require fullcalendar/calendar_events
//= require bootstrap-editable
//= require editable/editable_demo
//= require ibutton
//= require core_js/gritter
//= require core_js/calendar
//= require core_js/charts/xcharts_left_sine
//= require core_js/charts/xcharts_sine
//= require core_js/charts/xcharts_bar
//= require core_js/charts/sparkline_samples
//= require core_js/generic
//= require_tree .

宝石文件

source 'https://rubygems.org'

gem 'rails', '3.2.12'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'jquery-rails', '2.0.2'
gem 'rb-fsevent', '~> 0.9'
gem 'state_machine'
gem 'devise'
gem 'json', '~> 1.7.7'
gem 'activeadmin'

if RUBY_PLATFORM =~ /linux/i
  gem 'rb-inotify', '~> 0.9'
end


group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
  gem 'guard-rspec', '1.2.1'
  gem 'guard-spork', :github => 'guard/guard-spork'
  gem 'spork', '0.9.2'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'compass-rails'
  gem 'uglifier', '1.2.3'
end

group :test do
  gem 'capybara', '1.1.2'
  gem 'factory_girl_rails', '4.1.0'
  gem 'cucumber-rails', '1.2.1', :require => false
  gem 'database_cleaner', '0.7.0'
  gem 'launchy', '2.1.0'
  # gem 'rb-fsevent', '0.9.1', :require => false
  # gem 'growl', '1.0.3'
end

group :production do
 gem 'pg', '0.12.2'
end
4

1 回答 1

0

也许是因为这些线?

//= require jquery
...
//= require static_pages
//= require jquery191

尝试删除线//= require jquery191?或者jquery用它代替。或者static_pages最后加入。

于 2013-09-06T02:59:21.043 回答