bjarkig82
bjarkig82

Reputation: 578

Ruby on Rails - jQuery UI Touch Punch

I'm trying to use jquery-ui sortable(), the function has has to work on both mobile devices and desktop computers.

sortable() works fine when I use the mouse button or the touch screen on my laptop but not in mobile devices.

The app is built using Ruby on rails. I added jQuery using a gem but 'jQuery UI' and 'jQuery UI Touch Punch' by copying the source files into app/assets/javascripts.

The application.js has following lines:

//= require jquery
//= require jquery-ui
//= require jquery.ui.touch-punch.min
//= require jquery_ujs
//= require_directory ./jquery_plugins
//= require bootstrap.min

In the source of the app, I can find the following lines:

<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery-ui.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.ui.touch-punch.min.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>

It seems like it does not matter if I remove jquery.ui.touch-punch.min.js (which I thought should solve this problem) from the source.

Any advice is appreciated :-)

Upvotes: 2

Views: 1234

Answers (1)

Stef Hej
Stef Hej

Reputation: 1377

I prefer Touchpunch for the rails asset pipeline. Works perfect with android and ios devices.

Gemfile

gem 'touchpunch-rails'

application.js

//= require jquery.ui.touch-punch

Upvotes: 0

Related Questions