From 3d93a49712674788800c1e147d8c26f8edc387c0 Mon Sep 17 00:00:00 2001 From: Hagen von Eitzen Date: Thu, 15 Jun 2023 23:00:55 +0200 Subject: [PATCH] replace deprecated (as per jQuery 3.x) methods --- src/js/core.js | 8 ++++---- src/js/gallery.js | 4 ++-- src/js/image.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/js/core.js b/src/js/core.js index aaa18e7f..f0e88ac3 100644 --- a/src/js/core.js +++ b/src/js/core.js @@ -428,7 +428,7 @@ MagnificPopup.prototype = { if(mfp.st.autoFocusLast && mfp._lastFocusedEl) { - $(mfp._lastFocusedEl).focus(); // put tab focus back + $(mfp._lastFocusedEl).trigger('focus'); // put tab focus back } mfp.currItem = null; mfp.content = null; @@ -624,7 +624,7 @@ MagnificPopup.prototype = { var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn; if(disableOn) { - if($.isFunction(disableOn)) { + if(typeof disableOn === 'function') { if( !disableOn.call(mfp) ) { return true; } @@ -738,7 +738,7 @@ MagnificPopup.prototype = { return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) ); }, _setFocus: function() { - (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus(); + (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).trigger('focus'); }, _onFocusIn: function(e) { if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) { @@ -936,4 +936,4 @@ $.fn.magnificPopup = function(options) { } return jqEl; -}; \ No newline at end of file +}; diff --git a/src/js/gallery.js b/src/js/gallery.js index 6018b0f0..2132a8c6 100644 --- a/src/js/gallery.js +++ b/src/js/gallery.js @@ -116,11 +116,11 @@ $.magnificPopup.registerModule('gallery', { mfp.arrowPrev = arrowLeft; } - arrowLeft.click(function() { + arrowLeft.on('click', function() { if (gSt.langDir === 'rtl') mfp.next(); else mfp.prev(); }); - arrowRight.click(function() { + arrowRight.on('click', function() { if (gSt.langDir === 'rtl') mfp.prev(); else mfp.next(); }); diff --git a/src/js/image.js b/src/js/image.js index f5687c85..534054a4 100644 --- a/src/js/image.js +++ b/src/js/image.js @@ -6,7 +6,7 @@ var _imgInterval, var src = mfp.st.image.titleSrc; if(src) { - if($.isFunction(src)) { + if(typeof src === 'function') { return src.call(mfp, item); } else if(item.el) { return item.el.attr(src) || ''; @@ -241,4 +241,4 @@ $.magnificPopup.registerModule('image', { return template; } } -}); \ No newline at end of file +});