LENpolygon / Build-Order-Tool-AoE4-

Build Order Tool (for Age of Empires IV)
30 stars 15 forks source link

Materialize Modals do not work on one page. #29

Open LENpolygon opened 2 years ago

LENpolygon commented 2 years ago

On view.html the modals for logging in/ logging out do not work. Example page: https://age4builder.com/view.html?f=JnWOEtAcnLH0E79bxtnG

On index.html and build.html these modals dó work: image

MikeDrenth commented 2 years ago

This link stated in your post is not working.

LENpolygon commented 2 years ago

This link stated in your post is not working.

Thanks for letting me know. Updated it with another link example: https://age4builder.com/view.html?f=JnWOEtAcnLH0E79bxtnG

MikeDrenth commented 2 years ago

There is something wrong with the initialization of the modal on the view page.

Doing the follow give me a element back, but doing it on the view page, it gives me a undefined. Should check out if the init is done too late, or the order of the files might be wrong.

document.getElementById("modal-signup").M_Modal; image image

Also, i would like to recommend to make a 'global' or 'init' js file where you have js code that needs to be run on multiple pages instead of putting the same code in 3 different files. This is easier for debugging and managing your code.

LENpolygon commented 2 years ago

There is something wrong with the initialization of the modal on the view page.

Doing the follow give me a element back, but doing it on the view page, it gives me a undefined. Should check out if the init is done too late, or the order of the files might be wrong.

document.getElementById("modal-signup").M_Modal; image image

Also, i would like to recommend to make a 'global' or 'init' js file where you have js code that needs to be run on multiple pages instead of putting the same code in 3 different files. This is easier for debugging and managing your code.

Thanks for looking into this. That's how far I got as well, but I feel like I tried initialization of each part and the order in which they initialize multiple times, but don't see any different results. I've also tried putting that piece of code in a module, but my Javascript skills are wood-league level and that was something I did not get working either.

If there are more suggestions then I will look into it. Otherwise I might just leave it and redirect users to use this function on any other page.