在悬停不工作

时间:2013-10-05 00:42:01

标签: jquery hover maze

我创造了一个迷宫,不知道为何悬停不起作用 会很乐意提供任何帮助

$('.wall')
.bind('mouseenter', function() {
    $(this).css({
        'background-color': 'green'
    });
})

这里是小提琴链接:

http://jsfiddle.net/uqcLn/6/

1 个答案:

答案 0 :(得分:2)

在jsfiddle中使用它:

在html中添加:

<script type="text/javascript" src="http://codeorigin.jquery.com/jquery-1.10.2.min.js"></script>

并在脚本中执行此操作:

$(document).ready(function(){
    $(document).on("mouseenter",".wall",function(){
     $(this).css({
            'background-color': 'green'
        });
    });
    $(document).on('mouseleave',".wall", function () {
        $(this).css({
           'background-color': ''
        });
    });
});