Schedule a Free Consultation
Test if Flexslider loaded

Test if Flexslider loaded

Read Article

Recently I had a mini project for a client and I had to test if Flexslider has been shown on the screen in order to further modify it. Subscribing to the start callback didn’t work because the slider was shown by the theme and not by my code.

jQuery(document).ready(…) didn’t work either. The slider was there, but I couldn’t subscribe to click events on the arrows of the slider.

So I decided to go for a chained setTimeout sequence. I used it for Flexslider, but it can be used whenever you need to check that some things happened on the page and you really don’t have other (easy) alternatives.

Here’s how it looks like and it works:

Later edit:
Another approach would have been to use setInterval / clearInterval JavaScript functions. Next time.

Navigate to

Check some other articles we wrote

How to Choose the Best WordPress Maintenance Agency for Your Business [Complete Step by Step Guide]
WordPress started in 2003 as a blogging platform and made a phenomenal transition to an excellent CMS that now powers 43% of all websites, according to the latest statistics provided by W3Techs. Check here what you can build with WordPress. But like all software, things occasionally go wrong and need fixing. This and a couple […]
Working with a WordPress agency: Overcome difficult moments
A new hobby for my friend’s wife I have a friend, let’s call him John, who, not unlike many of us, had a very hectic year last year. As the saying goes, it was all work and no play. Neither he nor his wife had enough time and energy to pursue any of their hobbies. […]
Filter Custom Posts by Author in WP-Admin
Need to filter your Custom Post Types in WordPress by Author in WPAdmin? Here’s a handy way to do it by adding a new drop down for filtering: And here’s how it looks like: