We can call this a “hacky” solution because, like the other members of this thread, I don’t know exactly what this script is being used for. Here’s the code I used:
/* FlexSlider
/* ------------------------------------ */
var firstImage = jQuery('.flexslider').find('img').filter(':first'),
checkforloaded = setInterval(function() {
var image = firstImage.get(0);
if ( image ) {
if (image.complete || image.readyState == 'complete' || image.readyState == 4) {
clearInterval(checkforloaded);
jQuery('.flexslider').flexslider({
animation: "slide",
useCSS: false, // Fix iPad flickering issue
slideshow: false,
directionNav: true,
controlNav: true,
pauseOnHover: true,
slideshowSpeed: 7000,
animationSpeed: 400,
smoothHeight: true,
touch: false
});
}
}
}, 20);
$('select').dropkick();
});
Note that I enclosed the entire “if (image.complete || image.readyState == ‘complete’ || image.readyState == 4)” statement in an “if( image )” statement. Now, if image isn’t defined, it never gets to the code that was throwing an error.
Temporary fix until I can figure out what’s really up with this theme’s code and whether this is robust.