treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Jquery click CSS problem...in Chrome only?

  • Well this is just infuriating.

    http://keithpickering.net/site-designs/#comments

    I'm working on some styles for featured and buried comments. Click the buried comment and the "buried" class is removed, like this:

    $(document.body).on('click', '.buried', function() {
      $(this).removeClass('buried');
    });
    

    It works, but in Chrome and Chrome alone, the columns act all weird after the "buried" class is removed. Check it out in Chrome to see what I mean.

    If you go into the style editor and uncheck+recheck literally ANY style, it will work as expected.

    I'm pretty stumped with this.

  • Absolutely no problem on Chrome Canary. It works like a charm.

  • Why not;

      $('.buried').on('click', function() {
          $(this).removeClass('buried');
      }
    

    Or Zoidberg.

  • That's what I tried to begin with, but it doesn't work for some reason

  • Did you check console? Here it says "Uncaught SyntaxError: Unexpected token , "... So there is a JS error in your html output on... line 1 xD Too bad everything is on line 1.

  • I think I fixed it by adding "white-space: nowrap" to the comment module.

    But I'm still curious as to why this was actually happening.

    EDIT: Seems it also works when I get rid of the "border: 0" declaration on the "buried" module and instead set the border-color to the same as the background.

  • I'm not getting any errors in firebug, although I was testing some stuff a minute ago so that might be why you got an error.

    Another reason why I need to figure out a way to work on my site offline, but I have no idea how without manually downloading and re-uploading it every time I want to change something :P

  • $(document.body).on('click','.buried',function(){$(this).css({'height','auto'});}); I think that was where the error came from.

    Now it works (in Chrome 25), seeing you made that click listener removing the buried class again.