<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.MenuLList').find('a.Testing').hover(function() { $(this).addClass('Active'); }, function() { $(this).removeClass('Active'); });
});
</script>
<style type="text/css">
.MenuLList
{
list-style: none;
}
.MenuLList li
{
margin: 5px 0px;
}
.MenuLList li a
{
text-decoration: none;
}
.Inactive
{
color: Red;
width: 100px;
background-color: Yellow;
}
.Active
{
font-weight: bolder;
color: Green;
width: 300px;
background-color: Lime;
padding-left: 30px;
}
</style>
</head>
<body>
<ul class="MenuLList">
<li><a class="Inactive" href="#">Test 1</a></li>
<li><a class="Testing Inactive" href="#">Test 2</a> </li>
<li><a class="Testing Inactive" href="#">Test 3</a> </li>
<li><a class="Testing Inactive" href="#">Test 4</a> </li>
</ul>
</body>
</html>
난 그냥 그것을 시도 - 작동하는 것처럼 보인다. 업데이 트되면 나는 방화범 쟁이로 확인하고 활성 클래스는 '리'에 처음 '리'에만 설정되었습니다. 그리고 그것은 변함이 없었습니다. –
코드화 된대로 선택자의 부모 li 요소에만 적용되기 때문입니다. – Dutchie432
그러면 어떻게 리를 목표로 삼을 수 있습니까? –