【发布时间】:2014-09-25 21:24:24
【问题描述】:
在我搬到 RoR 之前,我使用了这个很棒的 jQuery countdown,它运行良好。 我尝试在我的 Rails (4.0.8) 应用程序中再次使用它,但我不明白为什么什么都没有显示。
我在 app/assets/javascripts 中(以及其他):
application.js
jquery.countdown.min.js
jquery-2.1.1.min.js
在我的 application.js 中:
//= require_tree .
//= require jquery-2.1.1.min
//= require jquery.countdown.min
在我的 Gemfile 中:
gem 'jquery-rails', '3.0.4'
在我的 app/views/pages/page.html.erb 中:
<br />
--
<div data-countdown="2016/01/01"></div>
--
<script type="text/javascript">
$('[data-countdown]').each(function() {
var $this = $(this), finalDate = $(this).data('countdown');
$this.countdown(finalDate, function(event) {
$this.html(event.strftime('%D days %H:%M:%S'));
});
});
</script>
喜欢documented on this page,但什么也没显示。
我是否遗漏了一些明显的东西?感谢您的帮助。
【问题讨论】:
标签: jquery ruby-on-rails countdown jquery-countdown