Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scrolling in mobile browser #50

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix scrolling in mobile browser
  • Loading branch information
akramghaleb authored Jul 13, 2024
commit c56ce546a7e2e0718b19e562d30f37b77fd804ca
43 changes: 29 additions & 14 deletions resources/views/kanban-scripts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,33 @@ function onUpdate(e) {
}

document.addEventListener('livewire:navigated', () => {
const statuses = @js($statuses->map(fn ($status) => $status['id']))

statuses.forEach(status => Sortable.create(document.querySelector(`[data-status-id='${status}']`), {
group: 'filament-kanban',
ghostClass: 'opacity-50',
animation: 150,

onStart,
onEnd,
onUpdate,
setData,
onAdd,
}))
})
const statuses = @js($statuses->map(fn ($status) => $status['id']));

statuses.forEach(status => {
const element = document.querySelector(`[data-status-id='${status}']`);
const sortableInstance = Sortable.create(element, {
group: 'filament-kanban',
ghostClass: 'opacity-50',
animation: 150,
onStart(event) {
// Disable dragging initially
sortableInstance.option('disabled', true);

// Re-enable dragging after 2 seconds
setTimeout(() => {
sortableInstance.option('disabled', false);
}, 1000);

// Call your original onStart function if needed
if (typeof onStart === 'function') {
onStart(event);
}
},
onEnd,
onUpdate,
setData,
onAdd,
});
});
});
</script>