salmon-oil-67352
01/09/2023, 7:47 PMhx-swap="innerHTML show:#header:top"
is added that it does not slow scroll to the top, but is there instantly? As if it's a "normal" page load?boundless-vase-80440
01/09/2023, 8:19 PMboundless-vase-80440
01/09/2023, 8:20 PMboundless-vase-80440
01/09/2023, 8:26 PMhundreds-cartoon-20446
01/09/2023, 9:00 PMhtmx.config.scrollBehavior = 'auto'
(js api) or via a meta tag <meta name="htmx-config" content='{"scrollBehavior":"auto"}'>
salmon-oil-67352
01/09/2023, 9:07 PM<meta name="htmx-config" content='{"scrollBehavior":"auto"}'>
did the tricksalmon-oil-67352
01/09/2023, 9:09 PMsalmon-oil-67352
01/09/2023, 9:09 PMsalmon-oil-67352
01/09/2023, 9:13 PMsalmon-oil-67352
01/09/2023, 9:19 PMancient-shoe-86801
01/09/2023, 9:49 PMbulky-kilobyte-96254
01/09/2023, 10:02 PMhx-swap
, its a grid view with pagination. It works perfectly, but it preserves its scroll position making it kinda hard to see that something happened if you're scrolled too far down (besides the pagination updating). Is it possible to scroll back up to the top of whatever div I `hx-swap`'ed with htmx?hundreds-cartoon-20446
01/09/2023, 10:23 PMdefaultSettleDelay
to 0 (default is 20) to make it seem instant.bulky-kilobyte-96254
01/09/2023, 10:25 PMhundreds-cartoon-20446
01/09/2023, 10:26 PMhtmx.on('htmx:beforeSwap', (event) => {
// disable smooth scrolling for 'main' element swaps
if (event.target.id === 'main') {
htmx.config.scrollBehavior = 'auto';
htmx.config.defaultSettleDelay = 0;
}
});
htmx.on('htmx:afterSettle', (event) => {
// re-enable smooth scrolling, if it was disabled
if (event.target.id === 'main') {
setTimeout(() => {
htmx.config.scrollBehavior = 'smooth';
htmx.config.defaultSettleDelay = 20;
}, 100);
}
});
refined-waiter-90422
01/09/2023, 10:33 PMmysterious-toddler-20573
01/09/2023, 11:29 PMboundless-vase-80440
01/10/2023, 12:34 AMprehistoric-garden-45720
01/10/2023, 3:25 AMhtmx-oob-swap
work with a <tr>
tag in order to prepend a table with a new row. htmx.logAll()
doesn't show anything happening for this <tr>
tag swap, while it works fine for other swaps. In the documentation and in other messages, I saw that I need to set `htmx.config.useTemplateFragments = true;`; how would I do this exactly, and where? Also, will it be a problem if I also include another, unrelated htmx-oob-swap
fragment in the response (it works fine with the other, non <tr>
swaps I perform, but I've seen messages that give me the impression that having more than one htmx-oob-swap
when one of them is in a <tr>
tag could cause issues (but I may have misinterpreted the message). Thanks.mysterious-toddler-20573
01/10/2023, 4:21 AMhtmx.config.useTemplateFragments
config option to true, so it can handle table-related tags properly. This will sacrifice IE compatibility, but will allow you to do oob table-related stuff.boundless-vase-80440
01/10/2023, 12:02 PMprehistoric-garden-45720
01/10/2023, 12:10 PM<head>
section of my web pages:
<script
src="https://unpkg.com/htmx.org@1.8.4"
integrity="sha384-wg5Y/JwF7VxGk4zLsJEcAojRtlVp1FKKdGy1qN+OMtdq72WRvX/EdRdqg/LOhYeV"
crossorigin="anonymous"
></script>
<script>
htmx.config.useTemplateFragments = true;
</script>
Even the Chrome Inspect tools shows true
when I type htmx.config.useTemplateFragments
in the Javascript console while the page is loaded. I'm quite a Javascript NOOB, so maybe I'm just doing it all wrong, but the ` section of the OOB swap still doesn't fire. Any other guidance to troubleshoot?late-king-98305
01/10/2023, 3:28 PM// 2DO: something something something
rich-television-50179
01/10/2023, 3:29 PMouterHTML
swap or how does that work?late-shampoo-89851
01/10/2023, 3:34 PMlate-shampoo-89851
01/10/2023, 3:39 PMrich-television-50179
01/10/2023, 3:42 PMcheckboxes
, inputs
, and maybe dropdowns
. If I want to include those in my hx-post
or hx-get
request how can I get all of those and add them to the request? In either js or html.mysterious-toddler-20573
01/10/2023, 4:12 PMmysterious-toddler-20573
01/10/2023, 4:14 PMhx-boost="false"
on that link.mysterious-toddler-20573
01/10/2023, 4:14 PM