-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: the modal is not work. #29
Comments
Hi @ichenhua
Thank you for your support in helping us improve FlyonUI! We’ve received your submission and will respond within few business days. Our team handles issues one at a time, and we’ll be reviewing yours as soon as possible. In the meantime, any additional details or a reproducible example would be greatly appreciated and will help us resolve the issue more efficiently. Thank you for your patience and understanding! |
Error:
|
Hello @ichenhua , The issue you are encountering is due to using the Note (for public methods only): To prevent initialization, you can add the <div id="modal-target" class="overlay modal overlay-open:opacity-100 modal-middle hidden" >
<div class="modal-dialog overlay-open:opacity-100">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Dialog Title</h3>
<button type="button" class="btn btn-text btn-circle btn-sm absolute end-3 top-3" aria-label="Close" data-overlay="#middle-center-modal" >
<span class="icon-[tabler--x] size-4"></span>
</button>
</div>
<div class="modal-body"> This is some placeholder content to show the scrolling behavior for modals. Instead of repeating the text in the modal, we use an inline style to set a minimum height, thereby extending the length of the overall modal and demonstrating the overflow scrolling. When content becomes longer than the height of the viewport, scrolling will move the modal as needed. </div>
<div class="modal-footer">
<button type="button" class="btn btn-soft btn-secondary" data-overlay="#a" > Close </button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<button id="open-btn" type="button" data-overlay="#modal-target" class="btn btn-primary" > Open modal using methods </button> window.addEventListener("load", function () {
const openBtn = document.querySelector("#open-btn");
openBtn.addEventListener("click", () => {
alert(111111);
HSOverlay.open("#modal-target");
});
}); By removing the |
@yagnikvamja Thank you for patiently answering my questions. I have more three questions to ask. 1、I want to call a function that I have wrapped myself. How can I achieve this? The following methods are not effective.
2、Regarding the documentation, could you please provide some appropriate supplements?For example, I want to call the modal component separately, but for beginners, with only the following explanation, they have no idea which JS file they should load.
3、Is there a suitable method to bundle the JS files loaded by the project into a single file?For example, writing it like this makes the code look so ugly.
|
@yagnikvamja Here's an additional question. 4、The jQuery core package referenced in the project is outdated, and the console shows warnings like this, which is very unhelpful.
|
Hello @ichenhua, I want to call a function that I have wrapped myself. How can I achieve this? The following methods are not effective.
Regarding the documentation, could you please provide some appropriate supplements?
Is there a suitable method to bundle the JS files loaded by the project into a single file?
The jQuery core package referenced in the project is outdated, and the console shows warnings like this, which is very unhelpful.
|
The first question is the most urgent, so let's focus on that first.
I hope that the second button, open-btn, triggers the modal. Why do we still need to use the first button querySelector('#modal-trigger')? Is the first button unnecessary? How can I use just one button to trigger a modal window through a custom function? |
Hello @ichenhua, Why do we still need to use the first button with The reason we need both buttons is as follows:
The first button is required because of the
How can I use just one button to trigger the modal window through a custom function? You can use the basic modal button without needing to call any methods. Can you please describe the scenario you are facing so we can help you. |
Do you mean that two buttons are required to trigger the modal function? It clearly only requires one button, yet it insists on adding an extra button as a placeholder? If that's the case, isn't this design a bit foolish? My requirement is very simple: I need a single modal to be shared among multiple sets of data on a list page, and I need to load data before showing the modal, so I need to customize a method. Examle:
|
Hello @ichenhua, I hope this message finds you well. To clarify, single button is required to open the modal, but the button must include the The example provided in the Flyon UI - Modal Usage documentation demonstrates the use of the As per your approch, the button needs the Currently, your code does not include the For such personalized customizations, please make use of the Discord community and discussion section. ~Best regards, |
Unfortunately, it seems that you have not been paying attention to my key issue. I cannot directly bind data-overlay to the button because I need to load some data before the popup appears. So I need to create a custom function to load the data first and then show the popup. Is it really that difficult to implement such a simple requirement? |
What version of FlyonUI are you using?
v1.2.0
Which browsers are you seeing the problem on?
No response
Reproduction URL
https://flyonui.com/docs/overlays/modal/#basic-examples
Describe your issue
I tried to launch model-target with openbtn, but it didn't work.
The text was updated successfully, but these errors were encountered: