I am attaching a file which I need some help with. @elementsbot has not been able to help.
The file contains one page only just made up from drag and drop core elements to give me a page - not important to project.
I have a modal id = scroll
If I attach a trigger - button it works fine.
I have replaced the trigger with custom HTML to act like a scroll function so when I scroll down page the modal appears - CTA box is my aim, the modal once again just contains a drag from core elements.
Currently when I scroll on preview a āwhite box with red borderā appears but not my modal.
I am stuck but any help to resolve this scroll malfunction will result in a CTA solution. Once I have this working then I will do a proper styled CTA solution.
Any help to resolve this please will be gratefully accepted.
Ah, a classic āscroll-triggered modalā issue! Letās see if we can sort this out. Here are a few things to check or try:
Ensure Correct ID: Double-check that the modalās ID is correctly set to scroll in both your custom HTML and the modal component settings.
Trigger Setup: Make sure your custom HTML for the scroll function is correctly triggering the modal. It might require JavaScript to conditionally display the modal when a certain scroll position is reached.
Debug CSS/Javascript: The āwhite box with red borderā sounds like a CSS failsafe or placeholder. Check your CSS to ensure thereās no style conflict. Also, verify your JavaScript logic is firing correctly and targeting the right elements.
Inspect with DevTools: Use browser DevTools to see if the modal itself is hidden or styled in a way that prevents it from displaying. Check for display: none; or opacity settings.
Scroll Position Logic: Ensure the logic for the scroll position in your script aligns with how your Elements page is structured.
If you are still stuck, feel free to share the details or any error messages here, and weāll continue poking at it! Maybe @ben, @upssjw, or @handshaper have additional insights?
Got your back in this epic battle against the invisible modal!
Oh, PMUK, it sounds like youāre taking on quite the modal mystery there! Letās give it another shot, shall we?
Ensure Correct ID: Double-check the modal ID is set as scroll and matches your JavaScript.
JavaScript Scroll Trigger: You need a script like this to trigger the modal on scroll:
window.addEventListener('scroll', function() {
if (window.scrollY > 100) { // Adjust 100 to your desired scroll position
document.getElementById('scroll').style.display = 'block'; // Or use classList to toggle visibility
}
});
Check CSS: Make sure thereās no unwanted CSS preventing the modal from showing. Use DevTools to inspect the modal and see if itās hidden or styled incorrectly.
JavaScript Debugging: Use console.log() to print messages when the scroll event starts and when the modal should appear to ensure the script is activating.
Visibility & Z-Index: Ensure the modal is set to be visible (display: block;) and has a high enough z-index to appear above other content.
Give these a try, and let me know how it goes! If it still gives you trouble, post some more details about your setup or any errors you see in the console.
And remember, in this wild journey, youāve got a cheeky AI bot with inconsistent solutions cheering you on!
No I have a modal which I want to open on a scroll trigger, the modal works if you add a button as trigger so nothing wrong with modal, I worked with the bot so I have the scroll bit working I have the modal working but the script the bot and I worked on opens a white box and NOT the modal. So simply I want to scroll down my page snd then half way (or wherever) a modal opens this can be for a newsletter sign up, a special offer box or whatever, which I can design but havenāt yet as I can not get scroll to open the modal just a white box. Whatās there are just scripts for me as reminders. Hope this is clear? THANKS for trying though I do appreciate it!
didnāt like all that css and js, converted to tailwind and alpine, not sure exactly what you were after, only pops up once now, reload will work again, added a trigger point control, you could use I suppose. Needs refining, dont like spending lots of time on one thing
Not sure why you wanted to have a modal show you could have just had a dropzone and put whatever you want in there
Thanks for helping, the code came from the bot as I asked to replace the button with a scroll over trigger. I dont know what a drop zone is but will look at that. If you look at the works.co.uk as I dont want to do a link, scroll down and you get a box pop up with an offer. Thats what I want to achieve but if you go in to it twice or cancel it it doesnt pop up again. Itās for my shop Iām building and want a āpop upā box to appear on scroll. I do not know whats best but your video does get modal to show. I just like simple solutions so what do you suggest as best way to achieve a pop up? TIA