small medium large xlarge

Generic-user-small
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.

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

Hello!

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); }
Generic-user-small
03 Feb 2017, 17:58
zhiguang xu (1 post)

Not working for me.

Samr_small_pragsmall
19 Feb 2017, 15:19
Sam Ruby (632 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.

Generic-user-small
22 Mar 2017, 09:38
James West (100 posts)

Same problem here with Rails 5.2 Empty cart browser console shows

document.querySelectorAll(“#cart tr”).length

1

So that’s all good. JQuiry is working as I get the flash effects when updating cart just no effect when displaying the cart from empty

You must be logged in to comment