Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
  <meta charset="utf-8">
  <title>Example</title>
</head>
<body>
  <div id="test">I'm the test div</div>
<script>
  (function() {
    "use strict";
    
    $("#test").css("marginLeft", 0);
    var counter = 0;
    var up = true;
    display("Initial marginLeft: " + $("#test").css("marginLeft"));
    setInterval(function() {
      if (up) {
        $("#test").css("marginLeft", "+=5");
      } else {
        $("#test").css("marginLeft", "-=5");
      }
      ++counter;
      if (counter > 10) {
        counter =0;
        up = !up;
      }
    }, 200);
    
    function display(msg) {
      $("<p>").html(String(msg)).appendTo(document.body);
    }
  })();
</script>
</body>
</html>
Output

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

Dismiss x
public
Bin info
tjcrowderpro
0viewers