CodeIgniter Forums
How best to Display an optional modal page - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: How best to Display an optional modal page (/showthread.php?tid=67589)

How best to Display an optional modal page - bgclmc1 - 03-12-2017

I have the case where I want to display a 'first time' page probably based upon a cookie. EG Open site, if cookie not set, display 'welcome' page with additional info on it (ideally centered in the viewport of the main page and again ideally, change the opacity of the main page) then set the cookie with expiry date of (say) 21 days. The idea is that for frequent visitors, they don't get bombarded with intro page. Ideally, force the user to close the intro page before continuing in the site proper. If cookie is set, just display normal first page.
I have tried <body onLoad="popup('', 'ad')"> which works but it appears to be reloading continuously (evidenced by adding an alert into the introduction form) so what I see is form load, alert, flicker (form load?) alert, flicker etc.
So my question is what is the best practice to achieve my goal? I could avoid the form load and just include a div in the main form and make it visible or not depending on the cookie but that seems to be avoiding the issue.
I have not yet included the cookie test and I assume that if I did, the problem would not be visible but it does not fix the real issue of why it seems to reload. I don't know if there is a codeigniter way to do this or even if it is related to codeigniter.

RE: How best to Display an optional modal page - dbrooke - 03-16-2017

Not to be confused with 'Model'... Sounds good to me.. pretty straight forward to do stuff based off of cookie info. Did you try it? bootstrap has a pretty good Model that can be enacted easily.