Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
drag and drop is not working in mobile view

drag and drop is not working in mobile view.

May I ask why drag and drop isnot working on some mobile phones or is it a problem with the browser?

eg. iphone12 not working but iphone 11 pro max is working.

How to solve the problem ?

$(".draggable").on({
  dragstart: function(e) {

    $target = $(e.target);
    $target.addClass("dragging");
    e.originalEvent.dataTransfer.setData("text", $target.text());
  },
  drag: function(e) {
  
  },
  dragend: function(e) {
  
    $(e.target).removeClass("dragging");
  }
});

$(".basket").on({
  dragenter: function(e) {
    $(e.target).addClass("dropping");
  },
  dragover: function(e) {
   
    e.originalEvent.addEventListener = "copy"; // "move", "link"
    return false;
  },
  dragleave: function(e) {

    $(e.target).removeClass("dropping");
  },
  drop: function(e) {
   
    $(e.target).removeClass("dropping");
    var $target = $(e.target);
    var dropText = "[" + e.originalEvent.dataTransfer.getData("text") + "]";
    $target.text($target.text() + " " + dropText);
  }
});
.basket {
    margin-top: 30px;
    width: 500px;
    height: 100px;
    border: 1px solid gray;
    background: lightgray;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="draggable" id ="Banana" draggable="true">Banana</div>
<div class="draggable" id ="Apple" draggable="true">Apple</div>
<div class="draggable" id ="Potato" draggable="true">Potato</div>
<div class="draggable" id ="Tomato" draggable="true">Tomato</div>
<div class="basket"></div>

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda