开发者

How to get a javascript overlay to load on startup

开发者 https://www.devze.com 2022-12-22 18:59 出处:网络
I 开发者_JAVA百科want to have a javascript overlay box load on startup inviting users to participate in a feedback survey.How can I do this.I do not want a separate window.Christopher,

I 开发者_JAVA百科want to have a javascript overlay box load on startup inviting users to participate in a feedback survey. How can I do this. I do not want a separate window.


Christopher,

It sounds like you want a non-intrusive "pop-up" dialog, but for it just to overlay the main page and not show up in a separate browser window. "jQuery UI" has lots of built-in goodies like this. A simple example of the code may look like this:

<script src="jquery.js" />
<script src="jquery-ui.js" />
<script type="text/javascript">
$(window).load(function () {
  $("#overlay_box").dialog();
});
</script>
...
<div id="overlay_box">
<!-- your HTML content here -->
</div>

For a live demo of the code above, as well as more details, visit: http://jqueryui.com/demos/dialog/

Hope that helps.
-tjw


You would want to use a div that you can show when the form is finished loading or some other event occurs. Here are a couple examples sample1, sample2


You could add function to window.onload thats shows you overlay when the page is loaded also are you using any framework alot of them have functionality like that.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号