Permalink
Browse files

Use on and off function instead of bind and unbind (jQuery 1.7)

  • Loading branch information...
1 parent 29ef228 commit d3a26488ed90d5cc28d376ef1ff006763db9e629 @nyroDev committed Jan 19, 2012
@@ -18,7 +18,7 @@ jQuery(function($, undefined) {
},
init: function(nm) {
nm.loadFilter = 'form';
- nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal', function(e) {
+ nm.opener.off('submit.nyroModal').on('submit.nyroModal', function(e) {
e.preventDefault();
nm.opener.trigger('nyroModal');
});
@@ -22,7 +22,7 @@ jQuery(function($, undefined) {
init: function(nm) {
nm.loadFilter = 'formFile';
nm.store.formFileLoading = false;
- nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal', function(e) {
+ nm.opener.off('submit.nyroModal').on('submit.nyroModal', function(e) {
if (!nm.store.formFileIframe) {
e.preventDefault();
nm.opener.trigger('nyroModal');
@@ -55,7 +55,7 @@ jQuery(function($, undefined) {
if (nm.store.formFileLoading) {
nm.store.formFileLoading = false;
var content = nm.store.formFileIframe
- .unbind('load error')
+ .off('load error')
.contents().find('body').not('script[src]');
if (content && content.html() && content.html().length) {
rmFormFileElts();
@@ -66,7 +66,7 @@ jQuery(function($, undefined) {
fct = function() {
nbTry++;
var content = nm.store.formFileIframe
- .unbind('load error')
+ .off('load error')
.contents().find('body').not('script[src]');
if (content && content.html() && content.html().length) {
nm._setCont(content.html(), nm.store.form.sel);
@@ -62,7 +62,7 @@ jQuery(function($, undefined) {
href: '#'
})
.addClass('nyroModalPrev')
- .bind('click', function(e) {
+ .on('click', function(e) {
e.preventDefault();
nm._callFilters('galleryPrev');
})
@@ -75,7 +75,7 @@ jQuery(function($, undefined) {
href: '#'
})
.addClass('nyroModalNext')
- .bind('click', function(e) {
+ .on('click', function(e) {
e.preventDefault();
nm._callFilters('galleryNext');
})
@@ -23,7 +23,7 @@ jQuery(function($, undefined) {
nm.loadFilter = 'iframeForm';
nm.store.iframeFormLoading = false;
nm.store.iframeFormOrgTarget = nm.opener.attr('target');
- nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal', function(e) {
+ nm.opener.off('submit.nyroModal').on('submit.nyroModal', function(e) {
if (!nm.store.iframeFormIframe) {
e.preventDefault();
nm.opener.trigger('nyroModal');
@@ -18,7 +18,7 @@ jQuery(function($, undefined) {
},
init: function(nm) {
nm.loadFilter = 'link';
- nm.opener.unbind('click.nyroModal').bind('click.nyroModal', function(e) {
+ nm.opener.off('click.nyroModal').on('click.nyroModal', function(e) {
e.preventDefault();
nm.opener.trigger('nyroModal');
});
@@ -522,7 +522,7 @@ jQuery(function($, undefined) {
if (_internal.firstInit) {
_internal._container = $('<div />').appendTo($b);
$w.smartresize($.proxy(_internal._resize, _internal));
- $d.bind('keydown.nyroModal', $.proxy(_internal._keyHandler, _internal));
+ $d.on('keydown.nyroModal', $.proxy(_internal._keyHandler, _internal));
_internal._calculateFullSize();
_internal.firstInit = false;
}
@@ -587,8 +587,8 @@ jQuery(function($, undefined) {
nm._callFilters('initFilters');
nm._callFilters('init');
nm.opener
- .unbind('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal')
- .bind({
+ .off('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal')
+ .on({
'nyroModal.nyroModal': function(e) { nm.open(); return false;},
'nmClose.nyroModal': function() { nm.close(); return false;},
'nmResize.nyroModal': function() { nm.resize(); return false;}
@@ -791,7 +791,7 @@ jQuery(function($, undefined) {
initElts: function(nm) {
nm.elts.bg.addClass('nyroModalBg');
if (nm.closeOnClick)
- nm.elts.bg.unbind('click.nyroModal').bind('click.nyroModal', function(e) {
+ nm.elts.bg.off('click.nyroModal').on('click.nyroModal', function(e) {
e.preventDefault();
nm.close();
});
@@ -810,7 +810,7 @@ jQuery(function($, undefined) {
var cur = $(this);
cur.nyroModal(nm.getForNewLinks(cur), true);
}).end()
- .find('.nyroModalClose').bind('click.nyroModal', function(e) {
+ .find('.nyroModalClose').on('click.nyroModal', function(e) {
e.preventDefault();
nm.close();
});
@@ -880,7 +880,7 @@ jQuery(function($, undefined) {
};
};
// smartresize
- jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
+ jQuery.fn[sr] = function(fn){ return fn ? this.on('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery,'smartresize');
// ucFirst

0 comments on commit d3a2648

Please sign in to comment.