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

    helpful-secretary-3515

    12/19/2020, 8:21 PM
    ... <button hx-get="https://assets.codepen.io/3413533/index_1.html" hx-trigger="revealed " hx-swap="afterend"> HTMX MAGIC ! ...
  • h

    helpful-secretary-3515

    12/19/2020, 8:21 PM
    but it does not work with "revealed", its swaping as soon , as the page is loading
  • h

    helpful-secretary-3515

    12/19/2020, 8:22 PM
    https://codepen.io/zen8/pen/QWKgPmp
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:23 PM
    Two options: have your response page include an HX-Trigger header that will fire an event (like "MyModalClosed"), then listen for this event in another part of your page (with
    hx-trigger="MyModalClosed"
    )
  • h

    helpful-secretary-3515

    12/19/2020, 8:23 PM
    btw, i want to use several diffrent modals in this page
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:23 PM
    Alternatively, you might have the modal target a specific part of the page
    <div class="modal-goodness" hx-post="/server" hx-trigger="otherDOMnode">
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:24 PM
    Ok, I see. You could possibly use several different event names. Or you could include some parameters in HX-Trigger header that are passed through to the event.
  • h

    helpful-secretary-3515

    12/19/2020, 8:26 PM
    i don't understand. i would love to get a practical advise
  • h

    helpful-secretary-3515

    12/19/2020, 8:27 PM
    would also spend some bucks / coffe , whatever
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:27 PM
    Yes, many moving parts to manage, and there's more than one way to accomplish everything.
  • h

    helpful-secretary-3515

    12/19/2020, 8:27 PM
    i want go along with HTMX , don't want to give up 🙂
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:27 PM
    Start with this, which button are you working on, the Submit button? What happens on the server when you submit?
  • h

    helpful-secretary-3515

    12/19/2020, 8:28 PM
    take a look here: https://codepen.io/zen8/pen/QWKgPmp
  • h

    helpful-secretary-3515

    12/19/2020, 8:28 PM
    there is just one button
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:30 PM
    going now.
  • h

    helpful-secretary-3515

    12/19/2020, 8:32 PM
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" hx-get="https://assets.codepen.io/3413533/index_1.html" hx-trigger="click, every 3s" hx-swap="afterend" hx-target="#htmx1"> Launch demo modal
  • h

    helpful-secretary-3515

    12/19/2020, 8:32 PM
    but the problem is, that i does not wait for the click. its starting to swap, every 3s
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:32 PM
    Ok, I think I see what's happening. When you click the button, it remotely loads the contents into the modal, then displays it on the page.
  • h

    helpful-secretary-3515

    12/19/2020, 8:32 PM
    exactly
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:33 PM
    Yes. I see this now. What if you put the hx-trigger="every 3s" in the content of the remotely loaded page fragment.
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:33 PM
    In the source of "https://assets.codepen.io/3413533/index_1.html"
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:33 PM
    Does this make sense?
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:34 PM
    I click the button and load the index_1.html into the modal, then that page continues to load more things into the dialog as long as its active on the page.
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:34 PM
    -- there will be some extra work once you CLOSE this dialog, but I think that would head down the right track 🙂
  • h

    helpful-secretary-3515

    12/19/2020, 8:39 PM
    i will try it in some minutes. THANK YOU
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:39 PM
    No worries 🙂
  • h

    helpful-secretary-3515

    12/19/2020, 8:41 PM
    i'm sitting in germany/hamburg , normally its saturday evening, and i would go to clubs, to do some party. but now because of this "goverment decisions", its quite as fuck here 🙂 " where are you located, and whats your status? :)=
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:41 PM
    I had one more suggestion -- when I load modals into the page, I load the whole modal, so "index_1.html" would include all of the Bootstrap boilerplate along with the actual contents. Then, when you're done, you can just remove the whole modal from the DOM to close it. There's a demo of this on the website -- https://htmx.org/examples/modal-bootstrap/
  • h

    helpful-secretary-3515

    12/19/2020, 8:41 PM
    good idea, will try
  • g

    gorgeous-ghost-95789

    12/19/2020, 8:41 PM
    I'm in Denver Colorado, USA.
1...104105106...1146Latest