[英]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.