Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery触摸打孔不工作_Javascript_Jquery_Ruby On Rails_Jquery Ui Touch Punch - Fatal编程技术网

Javascript jquery触摸打孔不工作

Javascript jquery触摸打孔不工作,javascript,jquery,ruby-on-rails,jquery-ui-touch-punch,Javascript,Jquery,Ruby On Rails,Jquery Ui Touch Punch,我试图让我的拖放功能在手机上工作。所以我尝试使用jquery touch punch,但它似乎无法在手机上实现拖放功能 这是我的密码。我将jquery.ui.touch-punch.min.js放在/app/assets/javascripts/文件夹中 =render :layout => 'shared/form_layout' do .row-fluid .col-xs-12.text-center#new-image %h1 Edit Collection

我试图让我的拖放功能在手机上工作。所以我尝试使用jquery touch punch,但它似乎无法在手机上实现拖放功能

这是我的密码。我将jquery.ui.touch-punch.min.js放在/app/assets/javascripts/文件夹中

=render :layout => 'shared/form_layout' do
  .row-fluid
    .col-xs-12.text-center#new-image
      %h1 Edit Collection
    = form_for @collection, :html => { :method => :put, :multipart => true } do |f|
      .row-fluid
        %label{for: "image"} Drag to Reorder:
        %script{:src => "http://code.jquery.com/jquery-1.7.2.min.js"}
        %script{:src => "http://code.jquery.com/ui/1.8.21/jquery-ui.min.js"}
        %script{:src => "/app/assets/javascripts/jquery.ui.touch-punch.min.js"}
        %ul.list-inline.form-group.edit-grid.clearfix#collectiondrag{"data-update-url" => sort_collections_url}
          - @images.each do |image|
            %li{class: "image", id: "image_#{image.id}"}
                .edit-item{:style => "background-image: url(#{image.photo.url})"}
        %hr.m-y-20
        .text-center
          = f.submit "Save Changes", class: "button btn btn-primary w-100", id: "sort_collection"

以下是我让Touch Punch开始工作的步骤:

  • 首先让你的网站在桌面上完全按照你想要的方式运行。touchpunch本身不做任何事情,它只是扩展了jqueryui
  • 下载Touch Punch javascript并将其包含在Rails应用程序中
    /app/assets/javascripts/
    可以,但我更喜欢将第三方javascripts放入
    /vendor/assets/javascripts/
  • 在jquery和jquery ui需要的所有文件之后,将该文件包括在
    应用程序.js
    文件中

那应该会让你振作起来

谢谢。我把它移到了卖主那里。因此,在application.js文件中,我将添加
/=requirejquery.ui.touch-punch.min.js
?另外,如果我添加了,我还需要这一行:
%script{:src=>“/app/assets/javascripts/jquery.ui.touch punch.min.js”}
利用并要求在
application.js
中使用所有的javascripts。您将使用
/=requirejquery.ui.touch-punch.min