Friday, 4 October 2013

How to write code for Jquery modal popup in asp.net


In this article I will explain How to apply CSS to model popup? And How to design Model popup window?
Below is the design for model popup code. Copy and paste it into your ASPX page and check.
<html>
<head>
<title>jQuery Popup Dialog - Click</title>
<style type="text/css">
#overlay {
positionfixed;
top0;
left0;
width100%;
height100%;
background-color#000;
filter:alpha(opacity=70);
-moz-opacity:0.7;
-khtml-opacity0.7;
opacity0.7;
z-index100;
displaynone;
}
.content a{
text-decorationnone;
}
.popup{
width100%;
margin0 auto;
displaynone;
positionfixed;
z-index101;
}


.content{
min-width600px;
width600px;
min-height150px;
margin100px auto;
background#f3f3f3;
positionrelative;
z-index103;
padding10px;
border-radius5px;
box-shadow0 2px 5px #000;
}
.content p{
clearboth;
color#555555;
text-alignjustify;
}
.content p a{
color#d91900;
font-weightbold;
}
.content .x{
floatright;
height35px;
left22px;
positionrelative;
top-25px;
width34px;
}
.content .x:hover{
cursorpointer;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type='text/javascript'>
$(function(){
var overlay = $('<div id="overlay"></div>');
$('.close').click(function(){
$('.popup').hide();
overlay.appendTo(document.body).remove();
return false;
});

$('.x').click(function(){
$('.popup').hide();
overlay.appendTo(document.body).remove();
return false;
});

$('.click').click(function(){
overlay.show();
overlay.appendTo(document.body);
$('.popup').show();
return false;
});
});
</script>
</head>
<body>
<div class='popup'>
<div class='content'>
<p>
Welcome to http://vatturidotnet.blogspot.in/. Please use above search option which was there in top right side to get help with many of articles.
<br/>
<br/>
<a href='' class='close'>Close</a>
</p>
</div>
</div>         
<div id='container'>
<a href='' class='click'><h2><b>Click Here to See Popup! </b></h2></a> <br/>
</div>
</body>
</html>

No comments:

Post a Comment