Prev Demo
AngularJS
>
Mouse Events
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> </head> <body> <script> var app = angular.module("app", []); app.controller("MouseController", function ($scope) { $scope.MouseDown = function ($event) { $scope.MouseDownDescription = $event + " Mouse down called" + new Date().getTime(); } $scope.MouseEnter = function ($event) { $scope.MouseEnterDescription = $event + " Mouse enter called" + new Date().getTime(); } $scope.MouseLeave = function ($event) { $scope.MouseLeaveDescription = $event + " Mouse leave called" + new Date().getTime(); } $scope.MouseMove = function ($event) { $scope.MouseMoveDescription = $event + " Mouse move called" + new Date().getTime(); } $scope.MouseOver = function ($event) { $scope.MouseOverDescription = $event + " Mouse over called" + new Date().getTime(); } $scope.MouseUp = function ($event) { $scope.MouseUpDescription = $event + " Mouse up called" + new Date().getTime(); } }); </script> <div ng-app="app" ng-controller="MouseController"> Perform mouse activity on below area <div ng-mousedown="MouseDown($event)" ng-mouseenter="MouseEnter($event)" ng-mouseleave="MouseLeave($event)" ng-mousemove="MouseMove($event)" ng-mouseover="MouseOver($event)" ng-mouseup="MouseUp($event)" style="background-color:#ededed;padding:10px;"> <img src="http://techfunda.com/Images/TechFunda.gif" alt="TechFunda.com logo"> </div> <hr /> <p>Mouse Down {{ MouseDownDescription }}</p> <p>Mouse Enter {{ MouseEnterDescription }}</p> <p>Mouse Leave {{ MouseLeaveDescription }}</p> <p>Mouse Move {{ MouseMoveDescription }}</p> <p>Mouse Over {{ MouseOverDescription }}</p> <p>Mouse Up {{ MouseUpDescription }}</p> </div> </body> </html>
Note: We DO NOT save your trial code in our database.
Output