$event 객체
$event 객체
$event함수를 호출 할 때 객체를 인수로 전달할 수 있습니다 .
$event객체는 브라우저의 이벤트 객체를 포함 :
예
<div ng-app="myApp" ng-controller="myCtrl">
<h1 ng-mousemove="myFunc($event)">Mouse Over Me!</h1>
<p>Coordinates: {{x + ', ' + y}}</p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.myFunc = function(myE) {
$scope.x = myE.clientX;
$scope.y = myE.clientY;
}
});
</script>
[전체소스]
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<h1 ng-mousemove="myFunc($event)">Mouse Over Me!</h1>
<p>Coordinates: {{x + ', ' + y}}</p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.myFunc = function(myE) {
$scope.x = myE.clientX;
$scope.y = myE.clientY;
}
});
</script>
<p>Mouse over the heading to display the value of clientX and clientY from the event object.</p>
</body>
</html>
$event함수를 호출 할 때 객체를 인수로 전달할 수 있습니다 .
$event객체는 브라우저의 이벤트 객체를 포함 :
예
<div ng-app="myApp" ng-controller="myCtrl">
<h1 ng-mousemove="myFunc($event)">Mouse Over Me!</h1>
<p>Coordinates: {{x + ', ' + y}}</p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.myFunc = function(myE) {
$scope.x = myE.clientX;
$scope.y = myE.clientY;
}
});
</script>
[전체소스]
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<h1 ng-mousemove="myFunc($event)">Mouse Over Me!</h1>
<p>Coordinates: {{x + ', ' + y}}</p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.myFunc = function(myE) {
$scope.x = myE.clientX;
$scope.y = myE.clientY;
}
});
</script>
<p>Mouse over the heading to display the value of clientX and clientY from the event object.</p>
</body>
</html>
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 88 | jQuery Mobile | 8년 전 | 1932 | ||
| 87 | jQuery Mobile | 8년 전 | 1912 | ||
| 86 | jQuery Mobile | 8년 전 | 1519 | ||
| 85 | jQuery Mobile | 8년 전 | 1831 | ||
| 84 | jQuery Mobile | 8년 전 | 1866 | ||
| 83 | jQuery Mobile | 8년 전 | 1882 | ||
| 82 | jQuery Mobile | 8년 전 | 1654 | ||
| 81 | jQuery Mobile | 8년 전 | 1370 | ||
| 80 | jQuery Mobile | 8년 전 | 1806 | ||
| 79 | jQuery Mobile | 8년 전 | 1355 | ||
| 78 | jQuery Mobile | 8년 전 | 1753 | ||
| 77 | jQuery Mobile | 8년 전 | 1779 | ||
| 76 | jQuery Mobile | 8년 전 | 1788 | ||
| 75 | jQuery Mobile | 8년 전 | 1399 | ||
| 74 | jQuery Mobile | 8년 전 | 1539 | ||
| 73 | jQuery Mobile | 8년 전 | 1246 | ||
| 72 | jQuery Mobile | 8년 전 | 1628 | ||
| 71 | jQuery Mobile | 8년 전 | 1621 | ||
| 70 | jQuery Mobile | 8년 전 | 1504 | ||
| 69 | jQuery Mobile | 8년 전 | 1511 | ||
| 68 | jQuery Mobile | 8년 전 | 2046 | ||
| 67 | jQuery Mobile | 8년 전 | 1315 | ||
| 66 | jQuery Mobile | 8년 전 | 1691 | ||
| 65 | jQuery Mobile | 8년 전 | 1183 | ||
| 64 | jQuery Mobile | 8년 전 | 1467 | ||
| 63 | jQuery Mobile | 8년 전 | 1656 | ||
| 62 | jQuery Mobile | 8년 전 | 1635 | ||
| 61 | jQuery Mobile | 8년 전 | 1875 | ||
| 60 | jQuery Mobile | 8년 전 | 1408 | ||
| 59 | jQuery Mobile | 8년 전 | 1964 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기