gorgeous-ghost-95789
05/30/2022, 8:39 PM<body script="on htmx:load call tippy.init(target)">gorgeous-ghost-95789
05/30/2022, 8:39 PMfamous-monitor-57000
05/30/2022, 8:39 PMfamous-monitor-57000
05/30/2022, 8:40 PMhtmx:load should go is in the body tag, or can I place it somewhere else and still have it run?gorgeous-ghost-95789
05/30/2022, 8:41 PMgorgeous-ghost-95789
05/30/2022, 8:41 PMgorgeous-ghost-95789
05/30/2022, 8:43 PMhtml
<script>
document.addEventListener('htmx:afterSwap', (event)=> {
doTheTippyStuffHere()
})
</script>gorgeous-ghost-95789
05/30/2022, 8:44 PMfamous-monitor-57000
05/30/2022, 8:44 PMmysterious-toddler-20573
05/30/2022, 9:19 PMmysterious-toddler-20573
05/30/2022, 9:19 PMfuture-table-82610
05/30/2022, 11:04 PMfuture-table-82610
05/30/2022, 11:05 PMrefined-waiter-90422
05/31/2022, 12:51 AMlate-king-98305
05/31/2022, 6:45 PM.htmx-request?icy-planet-32950
05/31/2022, 11:30 PMicy-planet-32950
05/31/2022, 11:32 PMhtmx.onLoad(function(content) {
var sortables = content.querySelectorAll(".sortable");
for (var i = 0; i < sortables.length; i++) {
var sortable = sortables[i];
console.log(sortable);
new Sortable(sortable, {
animation: 150,
ghostClass: 'blue-background-class'
});
}
});
to
htmx.onLoad(function(content) {
var sortables = document.querySelectorAll(".sortable");
for (var i = 0; i < sortables.length; i++) {
var sortable = sortables[i];
console.log(sortable);
new Sortable(sortable, {
animation: 150,
ghostClass: 'blue-background-class'
});
}
});square-analyst-94375
06/01/2022, 2:16 AMReact component that applies htmx.process() to the html it wraps? Looking to offer a migration option for some app code.refined-waiter-90422
06/01/2022, 2:20 AMrefined-waiter-90422
06/01/2022, 2:20 AMbrainy-ice-92385
06/02/2022, 2:11 AMconst HTMXify = ({ children }) => {
const ref = useRef();
useEffect(() => {
if (! ref.current) return;
htmx.process(ref.current)
}, [children])
return <div ref={ref}>{children}</div>
};
Just wrote this didn't test it, should be close to correct. CC @calm-ice-23682 because you 👀 'd thissquare-analyst-94375
06/02/2022, 2:34 AMbright-honey-15993
06/02/2022, 8:43 AMbright-honey-15993
06/02/2022, 8:46 AMget req, which will populate a different part of the page. How can I show a loading indicator for this? From what I can tell, the .htmx-request class is placed on the select, and so I don't have a way to reliably hide the existing content (the target), show the loading indicator, then hide the indicator and show the new content - I'm using display: none/block for these btw. Thanks!melodic-advantage-28381
06/02/2022, 9:12 AMripe-action-67367
06/02/2022, 11:06 AMdata-loading-class or data-loading attributes with custom styles to hide your elements. It also allows to set custom target element with data-loading-target attribute, which seems like exactly what you need. For more complex use-cases, you can hook into htmx events with hyperscript (or Alpine. Or vanilla JS) and update required styles as you wishbright-honey-15993
06/02/2022, 11:08 AMripe-action-67367
06/02/2022, 11:09 AMloading-states would be you best bet 😄bright-honey-15993
06/02/2022, 11:10 AMsquare-analyst-94375
06/02/2022, 4:54 PM