Christopher
Christopher

Reputation: 2103

How to get a javascript overlay to load on startup

I 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.

Upvotes: 3

Views: 7253

Answers (3)

Travis Webb
Travis Webb

Reputation: 15018

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

Upvotes: 1

Greg
Greg

Reputation: 1719

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.

Upvotes: 0

Matt Dearing
Matt Dearing

Reputation: 9386

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

Upvotes: 1

Related Questions