https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • w

    witty-garage-37227

    08/30/2022, 8:25 PM
    working
  • m

    mysterious-toddler-20573

    08/30/2022, 8:45 PM
    can you render these fragments directly as top level elements?
  • a

    adamant-salesmen-67924

    08/30/2022, 11:13 PM
    I can ask around and see if I can find out. Never used it that way, but I'm sure it's possible.
  • m

    mysterious-toddler-20573

    08/30/2022, 11:14 PM
    👍
  • a

    adamant-state-54102

    08/30/2022, 11:34 PM
    is the following possible:
  • a

    adamant-state-54102

    08/30/2022, 11:36 PM
    Click on on something in page fragment, start fading out the current content while simultaneously starting an hx-get to fetch the replacement, then hold onto the replacement response until the fadeout completes, and fade in the new content? Locally, you can do this with JS by chaining on
    transitionend
    but I am really curious if I can duplicate this kind of feature in pure htmx.
  • m

    mysterious-toddler-20573

    08/31/2022, 12:20 AM
    lemme see if I can do that
  • m

    mysterious-toddler-20573

    08/31/2022, 12:20 AM
    I don't think so, but maybe
  • m

    mysterious-toddler-20573

    08/31/2022, 12:21 AM
    are you willing to use hyperscript?
  • a

    adamant-state-54102

    08/31/2022, 12:26 AM
    sorry, i can't use hyperscript for this project
  • m

    mysterious-toddler-20573

    08/31/2022, 12:26 AM
    ok
  • m

    mysterious-toddler-20573

    08/31/2022, 12:26 AM
    looking at the code, I don't think this will work
  • m

    mysterious-toddler-20573

    08/31/2022, 12:26 AM
    however, I can help you hack the source if you really want this
  • a

    adamant-state-54102

    08/31/2022, 12:27 AM
    thanks for the offer, but it's not a big deal to do it locally in JS... it was more of a "hey, let me make sure i'm not overlooking some easier htmx way to do this..."
  • a

    adamant-state-54102

    08/31/2022, 12:45 AM
    @mysterious-toddler-20573 Real world, personal experience question for you: When using htmx on projects, how often do you find yourself breaking out the htmx paradigm and using a local JS solution for part of your page, for UX reasons (eg, because you want some effect like the animation I mentioned, or because a page fragment reload would be too heavy, or some other reason). I've heard you say you're very much a pragmatist and so aren't against such things, but I am curious how often you find yourself actually doing them?
  • m

    mysterious-toddler-20573

    08/31/2022, 12:54 AM
    Depends on the type of project or the feature. The more cruddy and poke-state-into-a-server, the less I bail from htmx.
  • m

    mysterious-toddler-20573

    08/31/2022, 12:54 AM
    When I'm working on online tools that mutate the local DOM, I'll use hyperscript
  • m

    mysterious-toddler-20573

    08/31/2022, 12:54 AM
    For something like a CRM I'd be mostly htmx
  • m

    mysterious-toddler-20573

    08/31/2022, 12:55 AM
    so, it might not be satisfying, but It Depends ™️
  • m

    mysterious-toddler-20573

    08/31/2022, 12:56 AM
    when I do bail from htmx, I try to keep it pure front end stuff. If I need to sync w/ a server, I try to keep that a hypermedia exchange. But I'm not going to kill myself doing that.
  • a

    adamant-state-54102

    08/31/2022, 5:08 AM
    Related question... Is there a mechanism like
    hx-get-local
    , which would simply "get" some local piece of (probably
    display:none
    ) html and swap that in? I'm thinking of places where you want 0-latency and have small bits of static html but still want to stay within the htmx paradigm....
  • r

    ripe-action-67367

    08/31/2022, 5:39 AM
    For individual attributes, you are probably better off with JS/_hs
  • r

    ripe-action-67367

    08/31/2022, 5:40 AM
    For fragments though, having
    hx-get="fragment:#template"
    that would retrieve data from a template tag could be an interesting idea of an extension
  • a

    adamant-state-54102

    08/31/2022, 5:42 AM
    Yes, this is what I had in mind.
  • b

    boundless-summer-65618

    08/31/2022, 7:20 AM
    hello everyone, i just joined the discord - look forward to learning a lot more about HTMX and being part of the community 👋 i'm following along with the examples on the website: https://htmx.org/examples/modal-bootstrap/ > We're replacing the standard Bootstrap Javascript library with a little bit of Javascript, which triggers Bootstrap's smooth animations. could someone please explain how to perform this replace step with the
    closeModal
    function so that i can get the example to work? i'm using django, if that matters. thank you!
  • l

    late-king-98305

    08/31/2022, 11:38 AM
    Trying to think if there's a good way in the frameworks with which I'm most familiar. Wondering if there's a way to do it with just straight HTML as well; rather than a wrapping structure like
    #fragment
    , you could pass this library just an ID, and it would pull it out and send just it.
  • l

    late-king-98305

    08/31/2022, 11:38 AM
    🤔
  • l

    late-king-98305

    08/31/2022, 11:43 AM
    I had a problem and though, "Hey, I'll use Java!" Now I have an
    AbstractProblemFactoryHelperImpl
    ...
  • g

    green-army-74971

    08/31/2022, 11:44 AM
    what do you guys make htmx-clickable elements? s, s, or something else? - : these don't get styled as links if href is not set, so can either set href=# or fix up the styling in CSS (add cursor: pointer, etc). - is semantically better, but then i have to strip off all its terrible default styling and make it like a link. (also, those who use buttons, do you set type=button, or just leave it?) - some other element, such as or : have to style these to look interactive (similarly to without href), but maybe that's not the worst? just wondering what you guys' approach is. (i'm using bootstrap, in case that's relevant, but interested in approaches generally.)
  • l

    late-king-98305

    08/31/2022, 11:50 AM
    I'll typically render the
    href
    and use
    hx-boost
    (usually way up near the top of the DOM) to make things work. I've also used links styled with
    btn
    classes, rendering the
    href
    in addition to
    hx-delete
    (or whatever it's actually doing). That way, the application should still work as a plain MPA even if htmx doesn't load for some reason.
1...803804805...1146Latest