0

Any idea why this works in development, but not when deployed on heroku:

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

The 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. I only want the :active effect to come into play when it is clickable. Thanks!

4
  • Where is that code? When does it run? Commented Oct 1, 2013 at 4:02
  • @muistooshort, the Coffeescript is in /home.js.coffee and the CSS is in custom.css.scss. Commented Oct 1, 2013 at 12:35
  • Is the code wrapped in a $(document).ready -> wrapper or similar? Does the code run at all? Commented Oct 1, 2013 at 18:44
  • Yes, I am using Coffeescript and the code begins with jQuery ->. It runs without a problem in my local environment, and the rest of the file (just not the add/removeClass portion) runs without issue when deployed. Commented Oct 1, 2013 at 18:54

1 Answer 1

1

If your code works on dev but not on heroku, then it's most likely not a problem with your code. I would start by looking at the Javascript console when viewing the site on heroku. You may see errors there.

Perhaps a gem that works locally is acting differently on heroku. Are you sure that there weren't any errors when pushing to heroku?

Any thing in your heroku logs? (type 'heroku logs').

You're going to need to post more information...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.