small medium large xlarge

17 Nov 2016, 15:43
Dong.Xu (1 post)

I added the code

if ($("#cart tr").length == 0) {
  $("#cart").show('blind', 1000);

in create.js.erb, but when I add book to cart, the side bar just show the cart content, but no animation.

18 Nov 2016, 21:03
mbigras (1 post)


I was just running into some problems with this section.

Make sure you remove your unless statement in _cart.html.erb

Also you need to check for a length of 1 like so:

if ($('#cart tr').length == 1) { $('#cart').show('blind', 1000); }
03 Feb 2017, 17:58
zhiguang xu (1 post)

Not working for me.

19 Feb 2017, 15:19
Sam Ruby (630 posts)

Try going into your browser’s javascript console and entering the following:

document.querySelectorAll("#cart tr").length

When there is no cart shown, this should return a 1 as there should be a hidden total line. If it returns a zero, make sure that you have defined a div with an id of cart, and included the table within that div.

You must be logged in to comment