简体   繁体   中英

How to auto open modal popup on Enter page

Can someone me to open the modal popup when a vistor requests the page for the very first time, a cokie hides it thereafter. I need to do a survey. They answer one question and are redirected so a close button or submit button is not needed. Im using php.

Thanks for the help. Bruce

Are you allowed to use jQuery? I would user jQuery + jQuery-UI (http://jqueryui.com/demos/dialog/)

What you have to do is just define a Div element with the markup of the popup, and then invoke the popup method used by jQuery UI in the document ready event.

eg

$(document).ready(function() {$( "#dialog" ).dialog();});

and

<div id="dialog"> Here goes your survey form</div>

Also it is a good idea to load jQuery and jQuery-UI from a CDN, like google's, use these addresses:

https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js
https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM