Creating a pop-up window in HTML is done using the jQuery library, which allows you to integrate an event handler into a web page and thereby make it possible to display the active content of the site.
Instructions
Step 1
Open your HTML site page in the text editor you use to write the code you want. You can also use the standard Windows Notepad utility to insert a pop-up window. To do this, right-click on the HTML file and select "Open With" - "Notepad".
Step 2
In the document section, create a layer that will handle jQuery:
Step 3
Then you need to set the name of the pop-up window. To do this, you can use the tiered HTML headers:
Window title
Step 4
After that, set the text that will be displayed in the window using the script to create a paragraph:
Text
Step 5
Then create a layer with class close_win to close the popup, before closing the previous handle:
Close a window
Step 6
Include the jQuery library in the file by adding the required tag between the document descriptors. For example:
Step 7
After that, enter the code to display the popup:
$ (function () {
$ ('# Show'). Hide ();
Step 8
Next, you need to handle the event that the user pressed the mouse button to invoke the pop-up window and handle the closing of the window. To do this, enter the following code:
$ (‘# Click-me’). Click (function () {$ (‘# show’). Fadein (300);})
$ (‘# Close_win’). Click (function () {$ (‘# show’). FadeOut (300);})
& lt / script>})
This program handles the user pressing the buttons for calling the pop-up window and clicking on the link to close it.
Step 9
To display the pop-up window on the page, you can use the link of the click-me class that was specified in the code above. To do this, enter the following code in the body of the document:
Click to show popup