Activate sortables only once

This commit is contained in:
Peter J. Holzer 2022-11-07 21:41:17 +01:00
parent 0877d7678f
commit e21caec1e2
1 changed files with 5 additions and 2 deletions

View File

@ -47,7 +47,7 @@
</form> </form>
</body> </body>
<script> <script>
htmx.onLoad(function(content) { function activateSortables(element) {
var sortables = document.querySelectorAll(".sortable"); var sortables = document.querySelectorAll(".sortable");
for (const sortable of sortables) { for (const sortable of sortables) {
console.debug("making", sortable, "sortable") console.debug("making", sortable, "sortable")
@ -56,7 +56,10 @@
ghostClass: 'blue-background-class' ghostClass: 'blue-background-class'
}); });
} }
}) }
activateSortables(document)
//htmx.onLoad(function(content) { activateSortables(content) }
</script> </script>
</html> </html>