When I dismiss the modal with the close butt the modal It won’t popup anymore, however when I submit the form the success message replaces the form and when I close that, using the close button the success mesage keeps popping up. Only when I refresh the page it stops. What could be the reason, or evev better how can avoid it from popping up without refreshing the page?
Edit: I think I should have posted this in Javascript.
Even if the close button prevents the modal from being shown again, there will still be those (now unnecessary) .height() and .scrollTop() computations for each scroll event; so you’d best remove the scroll handler altogether after the modal got shown:
$(window).on('scroll', function handleScroll () {
if ($(document).scrollTop() > $(document).height() / 2) {
$('#mailinglistModal').modal('show')
$(window).off('scroll', handleScroll)
}
})