Advanced Modal Popup Plugin - jQuery yBox

Advanced Modal Popup Plugin - jQuery yBox
File Size: 18.2 KB
Views Total: 3724
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

yBox is an animated, easy-to-use, feature-rich, jQuery modal popup plugin for any web content such text, iframes, images, galleries, and much more.

More Features:

  • Simple to implement without any JS call.
  • Supports Youtube and HTML5 videos.
  • AJAX content is supported as well.
  • Allows you to open another modal from within the current one.
  • Allows you to navigate between images with keyboard.

How to use it:

1. To use this modal popup plugin, download and insert the following files into your HTML page.

<!-- jQuery (required) -->
<script src="/path/to/cdn/jquery.min.js"></script>
<!-- yBox Stylesheet -->
<link rel="stylesheet" href="/path/to/dist/css/yBox.min.css" />
<!-- yBox Directives (optional) -->
<script src="/path/to/dist/js/directive.min.js"></script>
<!-- yBox JavaScript -->
<script src="/path/to/dist/js/yBox.min.js"></script>

2. Add the CSS class 'yBox' to the trigger element and specify the selector of the content to be displayed in the modal popup.

<a href="#content" class="yBox">Trigger Link</a>
<div style="display:none;">
  <div id="content">
    Any Modal Content Here

3. That's it. You can also display a modal popup on page load using the yBox method.


4. Fetch and display an iframe (like a Youtube video) in the modal popup.

<a href="" class="yBox yBox_iframe" rel="nofollow" title="Click Here">
  <img src=""  />

5. Apply an additional CSS class to the modal popup.

<a href="#content" data-ybox-class="myYboxClass" class="yBox">
  Trigger Link

6. Fetch and display an external page to the modal popup via AJAX requests.

<a href="" class="yBox yBox_ajax">Click Me</a>

7. HTML5 video is supported as well.

<a href="/path/to/video.mp4" class="yBox yBox_video">

8. Create a gallery lightbox by grouping your images using the data-ybox-group attribute:

<a href="1.jpg" class="yBox" data-ybox-group="group1">
  <img src="1.jpg" alt="" width="200" />
<a href="2.jpg" class="yBox" data-ybox-group="group1">
  <img src="2.jpg" alt="" width="200" />
<a href="3.jpg" class="yBox" data-ybox-group="group1">
  <img src="3.jpg" alt="" width="200" />

9. Show the popup when you have the parameter "systemmessage" in the url: Script

10. Trigger functions before/after open.

function beforeYboxOpen(self){
    alert('Before yBox open');

function yBoxIsOpen(self){
    alert('After yBox open');




  • Added before/after functions.


  • JS updated


  • JS updated


  • Open yBox inside Ajax yBox


  • JS update


  • Show the popup yBox when have parameter "systemmessage" in url


  • Close popup when blur the popup


  • changed language for youtube embed


  • Changed function names


  • JS & CSS update


  • focus on iframe on open yBox

This awesome jQuery plugin is developed by yuval123123. For more Advanced Usages, please check the demo page or visit the official website.