css animations

htmx
lza_menace 1 year ago
parent b721a14402
commit 31002694c9

@ -29,11 +29,11 @@ input {
display: none !important; display: none !important;
} }
.htmx-request .indicator{ .indicator .htmx-request{
display:inline; display:inline;
} }
.htmx-request.indicator{ .indicator.htmx-request{
display:inline; display:inline;
} }
@ -41,12 +41,16 @@ input {
text-decoration: underline dotted; text-decoration: underline dotted;
} }
#show_wallets { .showFade {
animation-name: example; animation-name: render;
animation-duration: 4s; animation-duration: .5s;
} }
@keyframes example { @keyframes render {
from {background-color: red;} from {
to {background-color: yellow;} opacity: 0;
}
to {
opacity: 1;
}
} }

@ -14,11 +14,24 @@
<div> <div>
<h3>Accounts</h3> <h3>Accounts</h3>
<div hx-get="/htmx/show_wallets" hx-target="#show_wallets" class="button outline" hx-indicator="#refreshLoader"> <div hx-get="/htmx/show_wallets" hx-target="#show_wallets" class="button outline" hx-indicator="#refresh_loader" onclick="handleRefresh()">
Refresh Refresh
<i class="fa-solid fa-rotate-right indicator" id="refreshLoader"></i> <i class="fa-solid fa-rotate-right indicator" id="refresh_loader"></i>
</div> </div>
<div hx-trigger="load" hx-get="/htmx/show_wallets" id="show_wallets"></div> <div hx-trigger="load" hx-get="/htmx/show_wallets" id="show_wallets" onload=""></div>
</div> </div>
<script>
function handleRefresh() {
const show_wallets = document.getElementById('show_wallets');
const loader = document.getElementById('refresh_loader');
loader.classList.add('fa-spin');
show_wallets.classList.add('showFade');
setTimeout(function() {
show_wallets.classList.remove('showFade');
loader.classList.remove('fa-spin');
}, 2000)
}
</script>
{% endblock %} {% endblock %}

Loading…
Cancel
Save