Skip to content

Commit b3218fc

Browse files
authored
Update jQuery.leanModal2.js
1 parent 6cf0992 commit b3218fc

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

jQuery.leanModal2.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// jQuery.leanModal2.js v2.3
1+
// jQuery.leanModal2.js v2.3.1
22
// MIT Licensed by eustasy http://eustasy.org
33
// Based on leanModal v1.1 by Ray Stone - http://finelysliced.com.au
44

@@ -7,7 +7,7 @@
77

88
// Function: Fade out the Overlay and a passed identifier
99
function leanModal_Close(modal_id) {
10-
$('.js-target-jquery-leanmodal-overlay').fadeOut(300);
10+
$('.js-leanmodal-overlay').fadeOut(300);
1111
$(modal_id).fadeOut(200);
1212
}
1313

@@ -19,7 +19,7 @@
1919
var defaults = {
2020
top: 100,
2121
overlayOpacity: 0.5,
22-
closeButton: false,
22+
closeButton: '.js-leanmodal-close',
2323
disableCloseOnOverlayClick: false,
2424
disableCloseOnEscape: false,
2525
};
@@ -28,9 +28,9 @@
2828
options = $.extend(defaults, options);
2929

3030
// If there isn't an overlay, add one.
31-
if ( $('.js-target-jquery-leanmodal-overlay').length == 0 ) {
31+
if ( $('.js-leanmodal-overlay').length == 0 ) {
3232
var style = 'background: #000; display: none; height: 100%; left: 0px; position: fixed; top: 0px; width: 100%; z-index: 100;';
33-
var overlay = $('<div class="js-target-jquery-leanmodal-overlay" style="' + style + '"></div>');
33+
var overlay = $('<div class="js-leanmodal-overlay" style="' + style + '"></div>');
3434
$('body').append(overlay);
3535
}
3636

@@ -41,18 +41,18 @@
4141

4242
$(this).unbind('click').click(function(e) {
4343

44-
// IFHREF Fetch the Modal_ID
45-
if ( $(this).attr('href') ) {
46-
var modal_id = $(this).attr('href');
47-
// IFHREF Fall back to if no href data-open-modal.
48-
} else if ( $(this).attr('data-modal-id') ) {
44+
// IFHREF Use data-open-modal if available
45+
if ( $(this).attr('data-modal-id') ) {
4946
var modal_id = $(this).attr('data-modal-id');
47+
// IFHREF Fall back to href
48+
} else if ( $(this).attr('href') ) {
49+
var modal_id = $(this).attr('href');
5050
} else {
5151
return false;
5252
} // IFHREF
5353

5454
// Set the function to close the overlay if you click it.
55-
$('.js-target-jquery-leanmodal-overlay').click(function() {
55+
$('.js-leanmodal-overlay').click(function() {
5656
if ( !options.disableCloseOnOverlayClick ) {
5757
leanModal_Close(modal_id);
5858
}
@@ -68,7 +68,7 @@
6868
// Close the modal on escape
6969
$(document).on('keyup', function(evt) {
7070
if (
71-
!options.disableCloseOnEscape &&
71+
!options.disableCloseOnEscape &&
7272
evt.keyCode == 27
7373
) {
7474
leanModal_Close(modal_id);
@@ -87,8 +87,8 @@
8787
'top': options.top + 'px'
8888
});
8989

90-
$('.js-target-jquery-leanmodal-overlay').css({ 'display': 'block', opacity: 0 });
91-
$('.js-target-jquery-leanmodal-overlay').fadeTo(300, options.overlayOpacity);
90+
$('.js-leanmodal-overlay').css({ 'display': 'block', opacity: 0 });
91+
$('.js-leanmodal-overlay').fadeTo(300, options.overlayOpacity);
9292
$(modal_id).fadeTo(200, 1);
9393

9494
// Prevent whatever the default was (probably scrolling).

0 commit comments

Comments
 (0)