링크를 클릭하면 "home"클래스 홈이 변경되어 다른 링크를 클릭 할 때까지 home1 클래스에 머물러야하지만 클래스는 변경되지만 다른 링크를 클릭하면 변경됩니다. "안녕 ""가정 "의 수업은 집 1에서 집으로 바뀌지 않으며 더 이상 클릭 할 수 없습니다. 내가 코드에 jQuery를 추가했지만 여전히 경고 상자 또는 원하는 결과가 PLZ 나에게 실수활성 의사 클래스가 작동하지 않습니다
을 지적하지body {
width:1020px;
margin:0 auto;
position:absolute;
}
.sidebar {
margin-left:10px;
}
.nav {
display:block;
margin-top:60px;
}
ul {
list-style-type:none;
}
a{
text-decoration:none;
border:none;
}
li.home{
background: $666 no-repeat;
width:150px;
height:65px;
color:#fff;
}
li.bye{
background: $666 no-repeat;
width:150px;
height:65px;
color:#fff;
}
li.home:hover {
background: #678fef no-repeat;
color:#fff;
}
li.bye:hover {
background: #678fef no-repeat;
color:#fff;
}
li.home1 {
background: #678fef no-repeat;
color:#fff;
}
li.bye1 {
background: #678fef no-repeat;
color:#fff;
}
CSS
<title>TEST</title>
<link href="css/test.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="text/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$("ul.nav li").click(function(e) {
var newclass=($(this).attr("class")+"1");
var oldclass=($(this).attr("class"));
alert($(this).attr("class")+"1");
$(this).attr("class",newclass);
});
</script>
</head>
<body>
<div class=sidebar>
<ul id=nav>
<li class="home"><a href="index.php"> Home</a></li>
<li class="bye"><a href="bye.php"> Bye </a></li>
</ul>
</div>
</body>
</html>
로
PHP는
u에서 볼 수 있습니다.
plz help
마우스가 li.home 위에 있으면 사진이 변경됩니까? CSS : hover는 마우스 오버를 의미합니다. 클릭하면 이미지를 변경하려면 그 – caramba