Last active
August 29, 2015 14:17
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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