sky_revolution
asked on
JQuery Modal Window OnLoad
I'm using a JQuery script that allows you to initiate a modal window. It currently works by attaching the event to a link (and opens the window when you click the link).
Here is an example below:
My question is: How would I modify this code to open the modal window as soon as the page loads?
The rest of the code for the modal window and the JQuery lib is included in the document <head> tags.
Here is an example below:
My question is: How would I modify this code to open the modal window as soon as the page loads?
<a href="#" id="link-anchor">Show Window</a>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$('#link-anchor').live('click',function(e){
// this is here to position the modal without jumping to the top of the page (because of the "#" href)
var toppos = $(this).offset(); e.preventDefault();
$.fbmodal({
modaltop : toppos.top-100,
type : 'info',
title : 'Default title',
text : 'Text goes here...',
closeTrigger : false,
escClose : false,
overlayClose : false,
buttons : [{ //been had objects
'text' : "Confirm",
'color' : "blue",
'callback' : function(){ alert("Confirmed"); $.fbmodal.close(); }
}]
});
});
});
</script>
The rest of the code for the modal window and the JQuery lib is included in the document <head> tags.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.