首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Twipsy和Tablesorter的Heroku资产无法正常工作,在本地是

Twipsy和Tablesorter的Heroku资产无法正常工作,在本地是
EN

Stack Overflow用户
提问于 2012-01-19 11:57:40
回答 1查看 1.1K关注 0票数 1

我想知道是否有其他人遇到了类似jQuery脚本的问题,比如Twipsy (来自Twitter bootstrap)和Tablesorter在本地工作,而不是在Heroku上工作。

每次我清理了public/assets文件夹并为部署环境预编译了一次。

脚本实际上显示在heroku上的预编译JS中,但它似乎无法识别……

奇怪的是,用于dropdown的第一个jQuery/Ajax函数在Heroku上运行得很好。

我在heroku cedar堆栈上使用Rails 3.1

下面是我的资产/应用程序.js

代码语言:javascript
复制
// 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 .

此外,更改配置资产也使其正常工作!

您的帮助我们将不胜感激。

奥里利安

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-01-31 23:47:18

也有类似的问题。将引导程序代码放在//= require_tree .行之前为我解决了这个问题。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8920836

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档