編集:これを簡単に理解するために、 not セレクターを使用して特定のタグの属性をフィルターし、子要素をフィルターしないようにしますか?
ここにある種の構文エラーがあるかどうか、または概念を理解していない可能性があるかどうか、誰かが私を助けてくれますか?
クリックすると本文のフォントサイズが変わるリスト項目があります。リスト項目が本文内にあるため、フォントが に変わります。この UL は同じフォントのままにしてほしい。そのため、以下に示すように .not("#ulSize") を使用しています。しかし、これは機能していません。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#liSmall").click(function () {
$('body').not('#ulSize').removeClass('large normal').addClass('small');
});
$("#liNormal").click(function () {
$('body').not('#ulSize').removeClass('large small').addClass('normal');
});
$("#liLarge").click(function () {
$('body').not('#ulSize').removeClass('small normal').addClass('large');
});
});
</script>
<style type="text/css">
.large
{
font-size: large;
}
.normal
{
font-size: medium;
}
.small
{
font-size: small;
}
</style>
</head>
<body>
<ul id="ulSize">
<li id="liSmall">Small Font</li>
<li id="liNormal">Normal Font</li>
<li id="liLarge">Large Font</li>
</ul>
Text in here!!!
</body>
</html>
君たちありがとう