Background
Last year, I got an outside project. The project was normal for anyone with more than one year of experience but no knowledge of JavaScript and CSS. The customer wanted popup windows for logging in the user. I encountered many problems when I tried to make the popup windows. So I will share a simple and perfect solution for popup windows without any lengthy JavaScript coding.
Requirements
No use of special jQuery for this popup window and no use also of special CSS.
Example
In the article make a login popup window. The Login Control is a server control. How it works is shown below.
I take two link buttons, this button is purely an HTML control.
- <div class="users">
- <div><a class="exist">Existing User</a> <a class="new">New User</a> </div>
- </div>


When I click on the button, I need to call a JavaScript function.
- $(document).ready(function () { //Ready function working when a complete window ready for work
- $('.exist').click(function () { //.exit is class in CSS
- var windowidth = ($(window).width() - 370) / 2; // for width used for the windows pop up
- var windoheight = ($(window).height() - 290) / 2; // For Height used for the windows pop up
- $('#login').css({ 'left': windowidth + 'px', 'top': windoheight + 'px' }); // Login is css class for Login window popup
- $('.light-container-1').css('height', $(document).height()); // light-container-1 is also another css class for used windows pop up.
- $('.light-container-1').show();
- });
Light-container-1 is the CSS used for the popup window. This CSS has nothing special but has a single image. This image covers the background window.


Vijayakumar SPosted May 2, 2020, 8:48 PM
This article is very useful to me.
Manish Kumar ChoudharyPosted Dec 7, 2014, 11:19 PM
Nice one Joginder Banger sir..
Joginder BangerPosted Dec 7, 2014, 3:09 AM
ahmet kalender no every code is clear...where is the issue you faced.
ahmet kalenderPosted Dec 7, 2014, 2:03 AM
This article is not enough to explain this issue. Also , some of codes are absent, I think.