So I have this right here:
It's a very simple UI Dialog that counts down until my user is redirected. If they click outside of the box it is canceled.
Is there anyway I can create this so that it is done on a URL click?
I also want to pass one parameter in (the url that the user is going to be redirected to)
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
function setClosed(){
isClosed=true;
}
function alertBlah() {
if (!isClosed)
$(location).attr('href',"http://www.google.com").delay(3000);
}
//Wait for the document to load
$(document).ready(function() {
isClosed=false;
//Create the dialog and open it
$("#dialog").dialog();
$("p.5").fadeOut(0).delay(500).fadeIn(400);
$("font.4").fadeOut(0).delay(1000).fadeIn(400);
$("font.3").fadeOut(0).delay(1500).fadeIn(400);
$("font.2").fadeOut(0).delay(2000).fadeIn(400);
$("font.1").fadeOut(0).delay(2500).fadeIn(400);
$("h2.by").fadeOut(0).delay(3000).fadeIn(400);
setTimeout(alertBlah,3500);
//Bind to the ui-widget-overlay and watch for when it is clicked
$('.ui-widget-overlay').live("click", function() {
//Close the dialog
$("#dialog").dialog("close");
setClosed();
});
});
</script>
</head>
<body style="font-size:62.5%;">
<div class="ui-widget-overlay" >
<a href="#" class="close">Leave My Site</a>
<div id="dialog" class="flora" title="Leaving my site" ><center>Leaving in...
<font class="5">5..</font>
<font class="4">4..</font>
<font class="3">3..</font>
<font class="2">2..</font>
<font class="1">1..</font>
</br>
<h2 class="by">Good By!</h2>
</center>
</div>