這個例子中的domEle是什麼?我可以在jQuery.com中看到一個解釋 - jQuery.each(collection,callback(indexInArray,valueOfElement)),但仍然很難理解什麼是「valueOfElement」?有人可以爲我清除一點嗎?我在學習時遇到的jQuery問題(初學者)
$("button").click(function() { $("div").each(function (index, domEle) { $(domEle).css("backgroundColor", "yellow"); if ($(this).is("#stop")) { $("span").text("Stopped at div index #" + index); return false; } }); });
,如果我會寫這樣的:
$("input[name='newsletter']").next().text(" is newsletter");
jQuery將只查找精確匹配,如果我這樣寫:$("input[name$='newsletter']").next().text(" is newsletter");
jQuery將找到精確匹配,可以說,「簡報」太的價值?作者使用此代碼:
$(document).mouseup(function(e) { if($(e.target).parent("a.signin").length==0) { $(".signin").removeClass("menu-open"); $("fieldset#signin_menu").hide(); } });
隱藏下拉每當用戶按下其他地方上的文檔。有人可以評論這條線
if($(e.target).parent("a.signin").length==0) {
,因爲我不完全明白我們在這裏做什麼。原文在這裏:http://aext.net/2009/08/perfect-sign-in-dropdown-box-likes-twitter-with-jquery/我應該知道的默認方法調用?
在教程之一,我發現了這樣的評論:
「最後,如果我們不包括在CSS保證金,CSS的方法調用的結果是自動,不會解析正常,所以我們需要用數字0"
var top = $('#comment').offset().top - parseFloat($('#comment').css('marginTop').replace(/auto/,0));
可以在這個人的評論來代替文字「自動」,因爲我不完全理解他在這裏做。
在這裏原創文章:http://jqueryfordesigners.com/fixed-floating-elements/
你應該打破個別問題中的一系列問題。每個問題都會有自己的答案。以這種方式詢問大量問題很難得到正確的答案。 – 2012-07-30 14:40:50