Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div class="animatedDots"></div>
</body>
</html>
 
.dot {
    position: absolute;
    height: 8px;
    width: 8px;
    border-radius: 50%;
    -moz-border-radius: 50px;
    -webkit-border-radius: 50px;
    border-width: 4px;
    border-style: solid;
    -webkit-background-clip: padding;
    -moz-background-clip: padding;
    background-clip: padding-box;
}
 
$(document).ready(function () {
    for (i = 0; i < 50; i++) { 
        createMarker();
    }
});
var randomX;
var randomY;
var marker;
var markerArray = [];
function createMarker(){
  marker = $("<div class='dot'>");
  $(".animatedDots").append(marker);
  
  setStartpnt();
}
$(".animatedDots").each(function(){
  markerArray.push(marker);  
});
console.log(markerArray[2]);
function setStartpnt(){
  randomX = Math.floor(window.innerWidth * Math.random());
  randomY = Math.floor(window.innerHeight * Math.random());
  marker.css({
    "transform":"translate("+randomX+"px, "+randomY+"px)"
  });
}
/*function fadeRandom() {
  el = marker.eq(Math.floor(Math.random() * marker.length));              
  el.fadeIn('1000').delay(2000).fadeOut('1000',fadeRandom);   
}*/
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers