You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.0 KiB
53 lines
1.0 KiB
|
|
function allowDrop(ev) {
|
|
ev.preventDefault();
|
|
}
|
|
|
|
function drag(ev) {
|
|
ev.dataTransfer.setData("ID", ev.target.id)
|
|
$('.drop-action').addClass('drop-inactive')
|
|
$('.droppable').removeClass('drop-inactive').addClass('drop-active')
|
|
}
|
|
|
|
function drop(ev) {
|
|
|
|
ev.preventDefault();
|
|
|
|
const target = $(ev.currentTarget).find('.modules-container')
|
|
const overlay = $('#dropConfirm')
|
|
const discard = overlay.find('.discard')
|
|
const confirm = overlay.find('.confirm')
|
|
const data = ev.dataTransfer.getData("ID")
|
|
|
|
let once = true
|
|
|
|
console.log('TARGET1:',target)
|
|
|
|
overlay.fadeIn()
|
|
|
|
discard.on('click',()=>{
|
|
if(once){
|
|
overlay.fadeOut()
|
|
once = false
|
|
}
|
|
})
|
|
|
|
confirm.on('click', ()=>{
|
|
|
|
if(once){
|
|
const module = $('#'+data)
|
|
target.append('<div class="div-drag">'+module.text()+'</div>')
|
|
overlay.fadeOut()
|
|
once = false
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
function dragLeave(ev) {
|
|
$('.drop-action').removeClass('drop-inactive')
|
|
$('.droppable').removeClass('drop-active')
|
|
}
|
|
|