DukeLeNoir/jQCloud — pull request #21 by cham (2012-03-01 14:56:36+00:00)
Title: Fixes a bug where the words are drawn when the cloud is not visible

I think this only affects the logic when delayedMode is on as otherwise the synchronous logic prevents the container being hidden, or you can simply check that the container is visible before invoking jQCloud.

To replicate, create a cloud with delayedMode on. Whilst the cloud is loading, hide the container, then show it again once the cloud has finished drawing (real world use case for this is a tabbed UI and the cloud loading in one tab). As the elements need to be measured in order to be positioned, if they are not visible then they are all positioned in the centre of the container, on top of each other.

This fixes the issue by checking $this.is(':visible ') before drawing each word. If it is not visible then it sets a timeout to check again in 10ms.