-
Notifications
You must be signed in to change notification settings - Fork 28
Can't add additional modals dynamically #6
Comments
See scottaohara#6 for more information. I know this isn't the best solution, but I'm not a great JS developer. Another alternative would be to add something like this: ``` /** * @param {Element} item */ ARIAmodal.addModal = function ( item ) { modal.push( item ); }; ``` and then refactor `setupModal` so it runs only on one modal at a time, then add a new `setupModals` method that would loop through all the items in the `modal` array and run `setupModal` on them. Again, I'm not great at JS. Thank you for the script, and please let me know if I can help with the PR.
Hey @zackkatz, thanks for the issue. I like the idea, but I'm going to think on this a bit. |
I also exposed |
Just wanted to check in and let you know I haven't forgotten about this issue, @zackkatz. Going to try and make sure I give it another look next week. Also want to mention that I've been doing working on refactoring the script in general, and this feature, and a few more, are in the works as part of that refactor too. |
Hi, |
I've got a working version having made a few changes. Main changes are var allyModal = (function ( w, doc, undefined ) { })( window, document ); allyModal.init(); This means I can call the allyModal.init() function anywhere and it takes the most uptodate DOM and runs at that point. Needed this so I can run it on html inserted from AJAX. Let me know if you think there are issues with this approach. |
Hey @scottaohara, any updates on this issue? I'd be glad to step in and help! |
been working on a big rewrite of the script which will address this issue. So should hopefully have something pushed within the next month or so. |
I'm trying to initialize modals for items added via an infinite scroll script. It isn't working, however, because
var modal
isn't accessible globally.The scoped
modal
variable is throughout the script, like insetupModal()
andsetupTrigger()
methods. There's no way to modify this important variable.Ideally, I'd like a way to be able to add modals to the
modal
variable, or add a method that would resetmodal
, then runinit()
again.The text was updated successfully, but these errors were encountered: