Hi there,
You are almost there.
The only thing you need to do is simulate the onclick event once the page has loaded to get your modal to display.

Originally Posted by
Nivi2013
Can you modify this and give me full functional code to open dialog box on page open with leanmodal.js
Just a tip - asking for the solution in this way is generally quite a good way to get your question ignored.
With this in mind, here's the code:
HTML Code:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Dialog using leanModal</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js" type="text/javascript"></script>
<script src="http://leanmodal.finelysliced.com.au/js/jquery.leanModal.min.js" type="text/javascript"></script>
<style type="text/css">
#lean_overlay{
position: fixed;
z-index:100;
top: 0px;
left: 0px;
height:100%;
width:100%;
background: #000;
display: none;
}
#DialogBox{
width:880px;
Height:auto;
}
</style>
</head>
<body>
<a id="overlaytrigger" rel="leanModal" href="#DialogBox" name="overlaytrigger">Basic
Popup</a>
<div id="DialogBox">
<h1>Welcome to my Home Page</h1>
</div>
<div id="lean_overlay"></div>
<script type="text/javascript">
$(function(){
$("#overlaytrigger").leanModal({ top : 200, closeButton: ".modal_close" });
$("#overlaytrigger").click();
});
</script>
</body>
</html>
Bookmarks