Blog & Documentations
  • Home
  • Marketing
    MarketingShow More
    Definitive Guide to Marketing Metrics, Analytics
    6 Min Read
    The Best 18 SEO Tools That SEO Experts Actually
    6 Min Read
    Ways to Ensure You Live Up to Customer Expectations
    6 Min Read
    10 CMS Features that Make Your Content Marketing
    6 Min Read
    Beginner’s Guide to Successful Email Marketing
    6 Min Read
  • Tutorial
    TutorialShow More
    How to use Manual Import for All Themes
    How to use Manual Import for All Themes
    How To Add Manual Site Or Remove Sites Domain From Licensed Key Themes
    How To Add Manual Site Or Remove Sites Domain From Licensed Key Themes
    How to Buy Themes and Payment Method
    How to Buy Themes and Payment Method
    Alternative Payments for Check Payment Method
    Alternative Payments for Check Payment Method
    How to See My License Key and Download Link
    How to See My License Key and Download Link
  • Contact
  • Blog
Reading: Create Simple jQuery Modal Popup
Share
Subscribe Now
Blog & DocumentationsBlog & Documentations
Font ResizerAa
  • Marketing
  • Resouce
  • Features
  • Guide
  • Complaint
  • Advertise
Search
  • Categories
    • Marketing
    • Resouce
    • Features
    • Guide
    • Lifestyle
    • Wellness
    • Healthy
    • Nutrition
  • More Foxiz
    • Blog Index
    • Complaint
    • Sitemap
    • Advertise
Follow US
Copyright © 2014-2023 Ruby Theme Ltd. All Rights Reserved.
Blog & Documentations > Blog > Tutorial > Create Simple jQuery Modal Popup
Tutorial

Create Simple jQuery Modal Popup

abereyhan By abereyhan Last updated: May 8, 2025
Create Simple jQuery Modal Popup
Create Simple jQuery Modal Popup
SHARE

Create Simple jQuery Modal Popup – hello how are you .. on this occasion I will share a tutorial to create a modal dialog with JQuery. and without using the many plugins available to create a modal dialog.

but this time we will create a simple modal dialog without using the plugin in order to understand how to create a modal dialog.

in previous tutorials we have discussed basic jquery tutorials. friends can see it HERE for the basic jquery tutorial that I have made.

CSS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<style>
 
/* 1. Ensure this sits above everything when visible */
.modal {
    position: absolute;
    z-index: 10000; /* 1 */
    top: 0;
    left: 0;
    visibility: hidden;
    width: 100%;
    height: 100%;
}
 
.modal.is-visible {
    visibility: visible;
}
 
.modal-overlay {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: hsla(0, 0%, 0%, 0.5);
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s linear 0.3s, opacity 0.3s;
}
 
.modal.is-visible .modal-overlay {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
 
.modal-wrapper {
  position: absolute;
  z-index: 9999;
  top: 6em;
  left: 50%;
  width: 32em;
  margin-left: -16em;
  background-color: #fff;
  box-shadow: 0 0 1.5em hsla(0, 0%, 0%, 0.35);
}
 
.modal-transition {
  transition: all 0.3s 0.12s;
  transform: translateY(-10%);
  opacity: 0;
}
 
.modal.is-visible .modal-transition {
  transform: translateY(0);
  opacity: 1;
}
 
.modal-header,
.modal-content {
  padding: 1em;
}
 
.modal-header {
  position: relative;
  background-color: #fff;
  box-shadow: 0 1px 2px hsla(0, 0%, 0%, 0.06);
  border-bottom: 1px solid #e8e8e8;
}
 
.modal-close {
  position: absolute;
  top: 0;
  right: 0;
  padding: 1em;
  color: #aaa;
  background: none;
  border: 0;
}
 
.modal-close:hover {
  color: #777;
}
 
.modal-heading {
  font-size: 1.125em;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
 
.modal-content > *:first-child {
  margin-top: 0;
}
 
.modal-content > *:last-child {
  margin-bottom: 0;
}
</style>

HTML

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<div class="wrapper">
    <h1>Simple jQuery Modal</h1>
    <button class="modal-toggle">Show modal</button>
  </div>
  
  <div class="modal">
    <div class="modal-overlay modal-toggle"></div>
    <div class="modal-wrapper modal-transition">
      <div class="modal-header">
        <button class="modal-close modal-toggle"><svg class="icon-close icon" viewBox="0 0 32 32"><use xlink:href="#icon-close"></use></svg></button>
        <h2 class="modal-heading">This is a modal</h2>
      </div>
      
      <div class="modal-body">
        <div class="modal-content">
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Impedit eum delectus, libero, accusantium dolores inventore obcaecati placeat cum sapiente vel laboriosam similique totam id ducimus aperiam, ratione fuga blanditiis maiores.</p>
          <button class="modal-toggle">Update</button>
        </div>
      </div>
    </div>
  </div>

JAVASCRIPT

1
2
3
4
5
6
7
8
<script src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script>
// Quick & dirty toggle to demonstrate modal toggle behavior
$('.modal-toggle').on('click', function (e) {
  e.preventDefault();
  $('.modal').toggleClass('is-visible');
});
</script>

Demo Simple jQuery Modal Popup

Click Here

A little addition, maybe some of you don’t know what the dialog modal is for, when it can be used. Actually, there are no special provisions regarding the use of modals on a website or application.

It depends on the wishes and design of a website or application. Usually, dialog modals are used to create warning messages, information messages that can be addressed to the user. And it can also be used to create a login form in the form of a dialog modal. So it’s up to you personally when you want to use the dialog modal.

That’s all for the tutorial on Create Simple jQuery Modal Popup (Without Plugins). Hopefully it can be useful for you who want to learn how to create a dialog modal using jQuery but don’t want to use the many plugins available.

TAGGED:Modal PopupSimple jQuery

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article A Guide to Effective SEO Tactics to Improve Ranking
Next Article Create Page With wp_insert_post() and AJAX Create Page With wp_insert_post() and AJAX
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

FacebookLike
XFollow
InstagramFollow
TiktokFollow

Subscribe Now

Subscribe to our newsletter to get our newest articles instantly!
Most Popular
How to use Manual Import for All Themes
How to use Manual Import for All Themes
May 8, 2025
How To Add Manual Site Or Remove Sites Domain From Licensed Key Themes
How To Add Manual Site Or Remove Sites Domain From Licensed Key Themes
May 8, 2025
How to Buy Themes and Payment Method
How to Buy Themes and Payment Method
May 8, 2025
Alternative Payments for Check Payment Method
Alternative Payments for Check Payment Method
May 8, 2025
How to See My License Key and Download Link
How to See My License Key and Download Link
May 8, 2025

You Might Also Like

jQuery Expand Collapse plus/minus Icons Accordion
Tutorial

jQuery Expand Collapse plus/minus Icons Accordion

Changing and Loading an Iframe ‘src’ attribute with jQuery
Tutorial

Changing and Loading an Iframe ‘src’ attribute with jQuery

Create Page With wp_insert_post() and AJAX
Tutorial

Create Page With wp_insert_post() and AJAX

Pure CSS Accordion without jQuery JavaScript
Tutorial

Pure CSS Accordion without jQuery JavaScript

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!
Blog & Documentations

We provide tips, tricks, and advice for improving websites and doing better search.

Latest News

  • SEO Audit Tool
  • Client ReferralsNew
  • Execution of SEO
  • Reporting Tool

Resouce

  • Google Search Console
  • Google Keyword Planner
  • Google OptimiseHot
  • SEO Spider

Get the Top 10 in Search!

Looking for a trustworthy service to optimize the company website?
Request a Quote
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?