简体   繁体   English

CSS / JS addClass可在开发中使用(Rails),但不能在heroku中使用

[英]CSS/JS addClass works in development (Rails) but not in heroku

Any idea why this works in development, but not when deployed on heroku: 知道为什么这在开发中有效,但在heroku上部署时无效:

    if $('#home-header').data('votable') == true
        $('#mpimage1').addClass('mpimage')
        $('#mpimage2').addClass('mpimage')
    else
        $('#mpimage1').removeClass('mpimage')
        $('#mpimage2').removeClass('mpimage')

The CSS: CSS:

.mpimage {
  width: 400px;
  height: 250px;
  overflow: hidden;
  border-radius: 2px;
  position: relative;
  &:active {
    top: 2px;
    box-shadow: 0 5px 0 3px #ccd2d2, 0 7px 20px 6px #d5dbdb;
  }
}

I need to do this because <div id="mpimage1"> and <div id="mpimage2"> are within a partial, and they are clickable when used on one page containing the partial, and they are not clickable on another page that uses the partial. 我需要这样做是因为<div id="mpimage1"><div id="mpimage2">都位于局部中,并且在包含该局部的一个页面上使用时它们是可单击的,而在包含该局部的另一页上它们则不可单击使用部分。 I only want the :active effect to come into play when it is clickable. 我只希望:active效果在可点击时起作用。 Thanks! 谢谢!

If your code works on dev but not on heroku, then it's most likely not a problem with your code. 如果您的代码可以在dev上运行,但不能在heroku上运行,那么您的代码很可能不是问题。 I would start by looking at the Javascript console when viewing the site on heroku. 在查看heroku上的站点时,我将首先查看Javascript控制台。 You may see errors there. 您可能在那里看到错误。

Perhaps a gem that works locally is acting differently on heroku. 也许在本地工作的宝石在heroku上的行为有所不同。 Are you sure that there weren't any errors when pushing to heroku? 您确定推入heroku时没有任何错误吗?

Any thing in your heroku logs? 您的heroku日志中有任何东西吗? (type 'heroku logs'). (键入“ heroku日志”)。

You're going to need to post more information... 您将需要发布更多信息...

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

相关问题 Magnific Popup Lightbox可在Ruby on Rails开发中使用,但在部署到Heroku时无法使用 - Magnific Popup Lightbox works in Ruby on Rails development but not when deployed to Heroku JavaScript在开发中发挥作用,而不在生产中发挥作用(Heroku) - JavaScript Works in Development, Not in Production (Heroku) Rails 4 App-JS在开发模式下可与Webrick一起使用,但不适用于Passenger / Apache2 - Rails 4 App - JS works with Webrick but not Passenger/Apache2 in Development Mode Rails 4:资产管道的常规CSS / JS开发工作流程? - Rails 4: Normal CSS/JS development workflow for asset pipeline? Sails JS-显示Flash消息不适用于Heroku(生产),但在开发中效果很好 - Sails JS - Display flash message doesn't work on Heroku(production) but works fine in development 应用程序在开发中有效,但在部署到 heroku 时无效 - App works in development but not when deployed to heroku jQuery在Heroku上有效,但在Rails localhost上无效 - jQuery works on Heroku, but not on Rails localhost 生产中出现JS错误,但没有开发轨道 - JS error on production but not development rails Heroku不会将js(仅限css)文件加载到生产中,但在本地它可以正常工作 - Heroku doesn't load js (only css) files to production but locally it works Rails Ajax Spinner正在开发中,但未在生产中工作 - rails ajax spinner works in development but not production
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM