新手问题 semantic-ui 的 javascript 不工作

VincentJiang · 2014年03月21日 · 最后由 jxs471494539 回复于 2014年03月21日 · 3824 次阅读

今天在配置 semantic-ui-sass with Rails,链接如下: https://github.com/doabit/semantic-ui-sass#semantic-ui-sass-with-rails 按照方法配置网站的 CSS 可以工作,但 Javascript 就不工作,请问有无高手可以为我解答? 以下是我 application.js 配置后的内容:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
// Loads all Semantic javascripts
//= require semantic-ui
//= require_tree .

谢谢!

页面源代码里面 semantic-ui 的 js 文件有没有? 如果有,那检查你的代码是不是写正确,光引用了 js 文件是不会工作的,比如要这样:

$('.ui.checkbox').checkbox();
$('.ui.dropdown').dropdown();

相应的功能才有

#1 楼 @miclle 感谢,按照你的方法已经解决问题!之前用惯了 Bootstrap,以为直接就就有效果的

需要 登录 后方可回复, 如果你还没有账号请 注册新账号