04 Jul 2012, 07:59
Generic-user-small

Daniel Chiu (1 post)

I’m using Rails 3.2.2 with Ruby 1.9.3p1294 viewing my depot application in Firefox. After many hours of frustration trying to figure out why my ajax code was not working, I discovered that the syntax provided in the book for revealing the cart:

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

was producing an error in the Firebug javascript console. The correct code ended up being this:

if ($('#cart tr').length == 1) { $('#cart').show('blind', null, 1000); }

providing an extra parameter for the show() function. After some more examination, I found that, while it doesn’t give me an error, the code in the book for the .animate() call does not work. My cart will highlight the background of the current item, but will not animate its return to the original background color. This is the segment of code in question:

$('#current_item').css({'background-color':'#88ff88'}).animate({'background-color':'#114411'}, 1000);

No matter what I try, I can’t get this animate call to work the way it should. Am I missing something crucial? Or is the book somehow outdated?

06 Jul 2012, 14:28
Samr_small_pragsmall

Sam Ruby (584 posts)

I just reran the scenario in the book with the latest Rails, Ruby, and it worked for me. The docs show that the second parameter for show is optional, and that the animate call is coded correctly.

http://jqueryui.com/docs/show/ http://jqueryui.com/demos/animate/

I wish I could be of more help.

29 Oct 2012, 05:56
Generic-user-small

Brian George (1 post)

Although this solution is way late, I had the same problem. The problem seemed to be that jQuery Color Animations > http://www.bitstorm.org/jquery/color-animation/ was needed.

I put the minified version into my assets/javascripts folder and included it in my app/views/layouts/application.html.erb with <%= javascript_include_tag “application”, “jquery.animate-colors-min” %>

I’m not sure if there’s a better way to do it, as I’m still learning, but I the problem has been identified at the very least.

26 Sep 2013, 20:17
Generic-user-small

Pavel Podkopajev (1 post)

Hello, I am still having an issue to get this show(‘blind’) and hide(‘blind’) methods to work, I do everything as it is written, but my cart appears with no effects. Just “bam” and it is there, and hides the same way.

jquery-ui gem is there … I am not sure what is the problem. Any help?

  You must be logged in to comment