我想知道是否有其他人遇到了类似jQuery脚本的问题,比如Twipsy (来自Twitter bootstrap)和Tablesorter在本地工作,而不是在Heroku上工作。
每次我清理了public/assets文件夹并为部署环境预编译了一次。
脚本实际上显示在heroku上的预编译JS中,但它似乎无法识别……
奇怪的是,用于dropdown的第一个jQuery/Ajax函数在Heroku上运行得很好。
我在heroku cedar堆栈上使用Rails 3.1
下面是我的资产/应用程序.js
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require jquery.tablesorter.min
//= require bootstrap-twipsy
//= require bootstrap-alerts
//= require bootstrap-dropdown
//= require bootstrap-modal
//= require bootstrap-popover
//= require bootstrap-scrollspy
//= require bootstrap-tabs
jQuery(function($) {
// when the #region_id field changes
$("#contact_country_id").live('change', function() {
// make a POST call and replace the content
var country = $('select#contact_country_id :selected').val();
if(country == "") country="0";
jQuery.get('/countries/update_city_select/' + country, function(data){
$("#cities").html(data);
})
return false;
});
});
jQuery(function($) {
$("#sortTable").tablesorter({
headers : {
5: {
sorter: false
},
8: {
sorter: false
},
9: {
sorter: false
}
},
sortList: [[0,0]]
});
});
jQuery(function($) {
$('.action-icon').twipsy();
$("a[rel=twipsy]").twipsy({
live: true
});
});
//= require_tree .此外,更改配置资产也使其正常工作!
您的帮助我们将不胜感激。
奥里利安
发布于 2012-01-31 23:47:18
也有类似的问题。将引导程序代码放在//= require_tree .行之前为我解决了这个问题。
https://stackoverflow.com/questions/8920836
复制相似问题