Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-app="app">
  <h3 noclick>this is text! (try to click and select)</h3>
</body>
</html>
 
(function(){
  angular.module("app", []);
  
  angular.module("app")
  .directive("noclick", function(){
    return {
      restrict: "A",
      link: function(scope, element, attr){
        scope.time = Date.now();
        
        element.on("mousedown mouseup", function(e){
          if(e.type == "mousedown"){
            scope.time = Date.now();
          }
          
          if(e.type == "mouseup"){
            if(Date.now() - scope.time > 100){
              return false;
            }else{
              console.log("clicked");
            }
          }
        });
      }
    }
  });
})(window, angular);
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers