<div><a href="#test">锚点a><div id="test">变色div>div><script>window.location ='#test'; $(':target').css('color','red'); script>
对应的CSS选择器是:target选择器,用于匹配锚点对应的目标元素
:target{color:red;}
动画状态
:animated
:animated选择器选择所有正在执行动画效果的元素
<button id="btn">runbutton><div id="mover" style="height:30px;width: 30px;background-color: green;">div><script>function animateIt() { $("#mover").slideToggle("slow", animateIt); } animateIt(); btn.onclick =function(){ $("div:animated").css('background-color','red'); } script>
显隐状态
:hidden
:hidden选择器选择所有隐藏的元素,返回集合元素
隐藏
元素不可见并不是隐藏,元素被认为隐藏有以下几种情况:
【1】display:none
【2】表单元素的type='hidden'