Skip to content

Instantly share code, notes, and snippets.

@mariusvetrici
Last active August 29, 2015 14:17
Show Gist options
  • Save mariusvetrici/3e33bc3919d8b8fb3c8a to your computer and use it in GitHub Desktop.
Save mariusvetrici/3e33bc3919d8b8fb3c8a to your computer and use it in GitHub Desktop.
Test if Flexslider loaded - or test if any element finished loading without AJAX events
// In my case, I had to wait for the Flexslider to load. The slider was added by the theme, not by my code, so I could not subscribe to the start callback event
jQuery("document").ready(function() {
waitForSlider();
});
function waitForSlider() {
// Test if slider is visible, i.e. loaded
if (jQuery(".wooslider-next").is(":visible")) {
// Do your stuff here. Slider is loaded
}
else
{
// Wait another 0,5 seconds
setTimeout(waitForSlider, 500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment