Guest User

Untitled

a guest
Jun 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. (function($) {
  2. $.fn.whenVisible = function(action) {
  3. $(this).each(function() {
  4. var el = this;
  5. var timer = setInterval(function(){
  6. if ($(el).height() == 0) {
  7. return;
  8. }
  9.  
  10. action.call(el);
  11.  
  12. $(el).trigger('visible');
  13.  
  14. clearInterval(timer);
  15. }, 0.1);
  16. });
  17.  
  18.  
  19. return this;
  20. };
  21. })(jQuery);
Add Comment
Please, Sign In to add comment