Konark

Untitled

Oct 10th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $('.sub').each(function() {
  2.     var $this = $(this);
  3.  
  4.     var ink, d, x, y;
  5.  
  6.     setInterval(function() {
  7.         if($this.find(".ink").length === 0){
  8.             $this.prepend("<span class='ink'></span>");
  9.         }
  10.              
  11.         ink = $this.find(".ink");
  12.         ink.removeClass("animate");
  13.          
  14.         if(!ink.height() && !ink.width()){
  15.             d = Math.max($this.outerWidth(), $this.outerHeight());
  16.             ink.css({height: d, width: d});
  17.         }
  18.          
  19.         x = Math.round(Math.random()*ink.width() - ink.width()/2);
  20.         y = Math.round(Math.random()*ink.height() - ink.height()/2);
  21.          
  22.         ink.css({top: y+'px', left: x+'px'}).addClass("animate");
  23.     }, 3000)
  24. });
Add Comment
Please, Sign In to add comment