简体   繁体   English

Twitter Bootstrap的jQuery Rails无法呈现

[英]jquery rails with twitter bootstrap does not render

I have made some progress here: rails 3 does not render jquery properly 我在这里取得了一些进展: Rails 3无法正确呈现jquery

With my test application, it works OK but with twitter bootstrap loaded - it does not work and it shows the drop down menu (which should be a palette). 在我的测试应用程序中,它可以正常运行,但是加载了twitter引导程序-它不起作用,并显示下拉菜单(应该是调色板)。 I have gone through steps to verify whether the jquery in rails renders the palette properly and this is my implemention to the one with twitter bootstrap. 我已经通过步骤来验证Rails中的jquery是否正确渲染了调色板,这是我对使用twitter bootstrap的实现。

As written in the post above, i had written the code into application.js: 如以上文章所述,我已将代码写入application.js:

//= require jquery
//= require jquery_ujs
//= require jquery.simplecolorpicker.js
//= require twitter/bootstrap
//= require_tree .
jQuery(document).ready(function(){
       jQuery('#print_colorpaper').simplecolorpicker();
    });

application.css application.css

 *= require_self
 *= require jquery.simplecolorpicker.css
 *= require_tree .

erb file erb文件

<%= f.select(:colorpaper, Print::MY_COLORS, :selected => '#ff887c') %>

You don't need to include css in the end of the file, try this in application.css 您不需要在文件末尾包含CSS,请在application.css中尝试

*= require jquery.simplecolorpicker

Or even put that file in app/assets/stylesheets and require_tree . 甚至将该文件放在app / assets / stylesheets和require_tree . will pick it up automatically. 会自动将其拾取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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