AngularJS鼠标进入划出事件

原创
2016/07/27 18:36
阅读数 966

link1.html

<!doctype html>
<html ng-app="MyModule">
	<head>
		<meta charset="utf-8">
	</head>
	<body>
		<hello>Hi everyone!</hello>
	</body>
	<script src="framework/angular-1.3.0.14/angular.js"></script>
	<script src="link1.js"></script>
</html>

link1.js

var myModule = angular.module("MyModule", []);
myModule.directive("hello", function () {
    return {
        restrict: "AE",
        link: function (scope, element) {
            console.log(element);
            element.bind("mouseenter", function () {
                console.log("鼠标进入...");
            });
            element.bind("mouseout", function () {
                console.log("鼠标滑出...");
            });
        }
    }
});
展开阅读全文
加载中

作者的其它热门文章

打赏
0
1 收藏
分享
打赏
0 评论
1 收藏
0
分享
返回顶部
顶部