-1
我创造一个迷宫,不知道为什么悬停不工作 会很高兴的任何帮助悬停不工作
$('.wall')
.bind('mouseenter', function() {
$(this).css({
'background-color': 'green'
});
})
这里是小提琴链接:
我创造一个迷宫,不知道为什么悬停不工作 会很高兴的任何帮助悬停不工作
$('.wall')
.bind('mouseenter', function() {
$(this).css({
'background-color': 'green'
});
})
这里是小提琴链接:
在jsfiddle中使用此功能:
in html add this:
<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': ''
});
});
});
你必须包括jQuery库使用其功能。 – Musa
您没有包含jQuery,只要添加它就可以工作 - http://jsfiddle.net/uqcLn/7/。在将来尝试检查您的浏览器的控制台的错误:http://stackoverflow.com/questions/4743730/what-is-console-log-and-how-do-i-use-it – Joe
请参阅http://jsfiddle.net/vYt9Q/1/ –