Drag and Drop in rails 3 – Education Career Blog

I am working on the drag and drop feature. I had a working code for that feature. Its written in rails 2.3.5. When I am shifted to rails 3, I used the same code. Actually drag and drop is working, but the position automatically changes in rails 3. In 2.3.5, position will not change.

<% for item in section_menu_items do %>
    <li id='<%= item:id %>' class='sec_drag'><%= image_tag(item:icon, :align => 'absmiddle', :style => 'margin-right: 5px;') %><%= item:text %></li>
    <%= draggable_element "#{item:id}", :scroll => 'window', :revert => true, :ghosting => true, :onEnd => "function(){ $('add_here_marker').hide();}" %>
    <% end %>

This is the sample code. The class “sec_drag” contains the position:relative. When I am dragging the element, the position is automatically changed to absolute.

Is the syntax changed for rails 3. Whats the solution for this?

Leave a Comment