Commit 428356db authored by Miguel Guerreiro's avatar Miguel Guerreiro Committed by Miguel Guerreiro
Browse files

Javascript improvements and fixes.

- Encapsulates the onChange event inside the document ready function. Sometimes it wasn't working properly.

- Removes animations. Instead changes the hide and show orders so it doesn't look "jumpy" when you switch options.
parent 530726b1
Loading
Loading
Loading
Loading
+17 −18
Original line number Diff line number Diff line
@@ -23,24 +23,23 @@
          $('.helpfulness_no_description').css('display', 'block');
        }
      }
    });

      $('input:radio[name=helpfulness_rating]').change(function () {
        var value = $(this).val();
      $('.form-item-helpfulness-comments').slideDown('slow');
      $('.helpfulness_submit_button').slideDown('slow');
        $('.form-item-helpfulness-comments').show();
        $('.helpfulness_submit_button').show();
        if (value === '1') {
        $('.helpfulness_no_title').hide('slow');
        $('.helpfulness_yes_title').slideDown('slow');
        $('.helpfulness_no_description').hide('slow');
        $('.helpfulness_yes_description').slideDown('slow');
          $('.helpfulness_no_title').hide();
          $('.helpfulness_no_description').hide();
          $('.helpfulness_yes_title').show();
          $('.helpfulness_yes_description').show();
        }
        else {
        $('.helpfulness_yes_title').hide('slow');
        $('.helpfulness_no_title').slideDown('slow');
        $('.helpfulness_yes_description').hide('slow');
        $('.helpfulness_no_description').slideDown('slow');
          $('.helpfulness_yes_title').hide();
          $('.helpfulness_yes_description').hide();
          $('.helpfulness_no_title').show();
          $('.helpfulness_no_description').show();
        }
      });

    });
})(jQuery);