move to embedded css, update hx state for spinner bug
This commit is contained in:
@@ -13,13 +13,21 @@ templ Layout(title string) {
|
||||
<body>
|
||||
{ children... }
|
||||
<script>
|
||||
document.body.addEventListener('htmx:beforeRequest', function(e) {
|
||||
e.detail.elt.classList.add('loading');
|
||||
});
|
||||
|
||||
document.body.addEventListener('htmx:afterRequest', function(e) {
|
||||
e.detail.elt.classList.remove('loading');
|
||||
});
|
||||
document.body.addEventListener('htmx:beforeRequest', function(evt) {
|
||||
evt.detail.elt.classList.add('loading');
|
||||
});
|
||||
|
||||
document.body.addEventListener('htmx:afterRequest', function(evt) {
|
||||
document.querySelectorAll('.loading').forEach(el => {
|
||||
el.classList.remove('loading');
|
||||
});
|
||||
});
|
||||
|
||||
document.body.addEventListener('htmx:beforeSwap', function(evt) {
|
||||
document.querySelectorAll('.loading').forEach(el => {
|
||||
el.classList.remove('loading');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user