Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Move HTML Divs (visual effects) using AJAX
2 Posts
Move HTML Divs (visual effects) using AJAX

Don't use MoveBy, it's deprecated (and I don't think you can actually get there with visual_effect because it always wants the newer style hash parameters whereas MoveBy is inline parameters). So this should work:

page.visual_effect :move, 'div_id', { :x => 10, :y => 100 }

Hi Friends,

I am working on the application, which has two sections on the page and have different items listed in those sections.

Suppose I click on item in the left section then It should move to right section of the page.

In order to give this visual effect, We can use following :

Move: Element Reference Moves the element from one location on the pag to another

MoveBy: Element Reference, y, x Moves an element smoothly by the stated x and y amounts. The element must have relative or absolute CSS positioning.

But I am not sure How do we code this in controller. I tried something like:

page.visual_effect :move_by, div_name, {:x => 10, :y => 100}

But I am not sure How do we state "x" and "y" parameters in it.

Any kind of assistance or hints in this issue would be helpful to me and highly appreciated.

Thanks.

2 Posts
Login to add your message