Gallery plugin patch for jQuery 1.9 : )
-
Hello guys, first off, great work on this. Love it and so happy to not have to use the full Jetpack : )
So just wanted to give you a heads up and others a quick patch. The site I’m using this plugin on uses jQuery 1.9, which resulted in the plugin not working as the plugin currently uses the now deprecated
$.browser
object for jQuery < 1.9 (lines 137-140):if ( $.browser.mozilla ) leftWidth -= 55; else if ( $.browser.msie ) leftWidth -= 20;
Not quite sure where WordPress core is in terms of adopting the use of jQuery 1.9, but wanted to throw out how I patched this up. I basically tested for whether
$.browser
is a valid function (aka if jQuery is < 1.9) and then setup the relevant code to handle both situations so we are gracefully handling both situations:if( ! $.isFunction( $.browser ) ) { var isMozilla = navigator.userAgent.match(/Firefox/i) != null; var isMSIE = navigator.userAgent.match(/MSIE/i) != null; if ( isMozilla ) leftWidth -= 55; else if ( isMSIE ) leftWidth -= 20; leftWidth += 'px'; } else { if ( $.browser.mozilla ) leftWidth -= 55; else if ( $.browser.msie ) leftWidth -= 20; leftWidth += 'px'; }
It’s obviously not ideal to alter plugin code, which I realize, I just really wanted to use this and couldn’t find a Github repo for this : ) So by all means, use this as you see fit or when / if it makes sense. Thanks!
https://www.ads-software.com/extend/plugins/carousel-without-jetpack/
- The topic ‘Gallery plugin patch for jQuery 1.9 : )’ is closed to new replies.