我有一堆項目與選中的同一類打開工具提示和下拉菜單。它適用於單個項目,但爲了讓每個人都能使用它的特定子項,我使用了.children()。它似乎在一些地方起作用,但在其他地方卻不起作用。我已經縮小了什麼不起作用,但是爲什麼......請幫助。我努力讓.children()工作
HTML:
<div class="topIcon">
<a href="stream.html"><img src="icons/stream16lg.png" /></a>
<div class="topIconNew"></div>
<div class="topTip">
<div class="topTipText">Stream</div>
</div>
<div class="topDrop">Hello</div>
</div>
的jQuery:
$("div.topIconNew").click(function(){
//working
$(this).parent("div.topIcon, div#topSend, div#topTool").css("background-color","#555555");
//working
$(this).children("div.topTip").show();
//not working
$(this).children("div.topTip").animate({width:320,marginLeft:-240},"fast");
//not working
$(this).children("div.topDrop").slideDown(240);
clicked = true;
});
我沒有包括CSS,因爲我不知道它的真正的問題是在這裏。我想這是我的jQuery,但我真的不知道。任何和所有的幫助表示讚賞。
+1的真棒標題 –
「我掙扎着爬。孩子()的工作。」嘿,存在童工勞動法的原因。 –
你應該開始[「接受」](http://meta.stackexchange.com/a/5235/147495)的答案,並使用額外的投票了任何有用的答案和問題,你會發現(見[這裏](http ://stackoverflow.com/faq#howtoask))。您有權每天投票約30個答案或問題(請參閱[此處](http://meta.stackexchange.com/a/5213/147495))。投票有助於其他人在計算器上找到最有趣的信息。 – Oleg