This may be a synchronization problem, flexslider may require loading images when it is called so that it can turn off its attributes, remember that $ (document) .ready () is triggered after the DOM download finishes, while $ (window) .load () fires after loading all the images on the page - gives you periodic results, if they are cached, etc., replace:
$(document).ready(function(){ ... });
from
$(window).load(function(){ ... });
By the way, a working github example also uses $ (window) .load.
source share