Skip to content

Commit

Permalink
Merge pull request #8 from adrianolaru/new-events-methods
Browse files Browse the repository at this point in the history
Replaced bind/unbind and live with on/off methods
  • Loading branch information
kylefox committed Feb 18, 2012
2 parents 5350977 + 421516e commit ba3cda3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions jquery.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
opacity: options.opacity
});
if(options.escapeClose) {
$(document).bind('keydown.modal', function(event) {
$(document).on('keydown.modal', function(event) {
if(event.which == 27) {$.fn.modal.close();}
});
}
Expand Down Expand Up @@ -92,7 +92,7 @@
current_modal.elm.trigger($.fn.modal.CLOSE, [current_modal]);
current_modal = null;

$(document).unbind('keydown.modal');
$(document).off('keydown.modal');
};

$.fn.modal.resize = function() {
Expand All @@ -109,7 +109,7 @@
$('<div/>')
.html(html)
.appendTo('body')
.bind('modal:close', function(event, modal) { modal.elm.remove(); })
.on('modal:close', function(event, modal) { modal.elm.remove(); })
.modal();
});
}
Expand All @@ -127,7 +127,7 @@
};

// Automatically bind links with rel="modal:close" to, well, close the modal.
$('a[rel="modal:open"]').live('click', open_modal_from_link);
$('a[rel="modal:close"]').live('click', $.fn.modal.close);
$(document).on('click', 'a[rel="modal:open"]', open_modal_from_link);
$(document).on('click', 'a[rel="modal:close"]', $.fn.modal.close);

})(jQuery);

0 comments on commit ba3cda3

Please sign in to comment.