마지막 줄의 .add
이 예상대로 작동하지 않으면 문서의 :first-child
이 수정되었으므로 이동 객체의 :first-child
만 수정하면됩니다. 나는 내가 생각할 수있는 모든 것을 시도했다. 문제가 무엇인지 전혀 모른다.호버에 해당하는 객체에 jquery selector를 적용합니다.
jQuery.fn.img=function(background,param,repeat)
{ $(this).css('background-image','url(/static/img/'+background+'.png')
.css('background-repeat',repeat)
.css('background-position',param+' top');}
$('#sliding-door li').hover(function(e)
{$(this).img('b1_middle_focus','left','repeat-x');
$(this).add(':first-child span').img('b1_left_focus','left','no-repeat');},
HTML :
<ul>
<li><a href="/href1"><span><span>Something</span></span></a></li>
<li><a href="/href2"><span><span>Another thing</span></span></a></li>
</ul>
'.add()'? '.find()'를 의미하지 않습니까? – BoltClock
고마워, 작동 했어. – titus
좋아, 대답으로 올렸다. – BoltClock