做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

jquery選擇器:last與:last-child兩者的區別

來源:懂視網 責編:小采 時間:2020-11-27 20:19:03
文檔

jquery選擇器:last與:last-child兩者的區別

jquery選擇器:last與:last-child兩者的區別:今天寫$("ul li:last-child").offset().top發現報錯,而$("ul li").last().offset().top就沒錯了。原因在于:這兩個選擇器都是匹配集合中的最后一個元素,差別在于 :last 將匹配所有的集合中的最后一個元素。而 :last-ch
推薦度:
導讀jquery選擇器:last與:last-child兩者的區別:今天寫$("ul li:last-child").offset().top發現報錯,而$("ul li").last().offset().top就沒錯了。原因在于:這兩個選擇器都是匹配集合中的最后一個元素,差別在于 :last 將匹配所有的集合中的最后一個元素。而 :last-ch

今天寫$("ul li:last-child").offset().top發現報錯,而$("ul li").last().offset().top就沒錯了。原因在于:
這兩個選擇器都是匹配集合中的最后一個元素,差別在于 :last 將匹配所有的集合中的最后一個元素。而 :last-child 將匹配集合中的所有位置為最后一個的子元素。:last 將永遠返回一個元素,而 :last-child可能返回一批元素。
原來如此啊!

:last Selects the last matched element.
Note that :last selects a single element by filtering the current jQuery collection and matching the last element within it.
Additional Notes:
Because :last is a jQuery extension and not part of the CSS specification, queries using 
:last cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. 
To achieve the best performance when using :last to select elements, first select the elements using a pure CSS selector, then use.filter(":last").

:last-child:

Selects all elements that are the last child of their parent.

<div>
<span>John,</span>
<span>Karl,</span>
<span>Brandon,</span>
<span>Sam</span>
</div>
<div>
<span>Glen,</span>
<span>Tane,</span>
 
<span>Ralph,</span>
<span>David</span>
</div>
<script>
$("div span:last-child")
.css({color:"red", fontSize:"80%"})
.hover(function () {
$(this).addClass("solast");
}, function () {
$(this).removeClass("solast");
});

這兩個選擇器都是匹配集合中的最后一個元素,差別在于 :last 將匹配所有的集合中的最后一個元素。而 :last-child 將匹配集合中的所有位置為最后一個的子元素。:last 將永遠返回一個元素,而 :last-child可能返回一批元素。

$('div p:last') 選擇最后一個P元素并高亮顯示得出結果如下:

<div>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
</div>
<div>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
</div>
<div>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
</div>

$('div p:last-child') 將選擇所有位于div最后一個p子元素,并高亮:

<div>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
</div>
<div>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
</div>
<div>
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
</div>

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

jquery選擇器:last與:last-child兩者的區別

jquery選擇器:last與:last-child兩者的區別:今天寫$("ul li:last-child").offset().top發現報錯,而$("ul li").last().offset().top就沒錯了。原因在于:這兩個選擇器都是匹配集合中的最后一個元素,差別在于 :last 將匹配所有的集合中的最后一個元素。而 :last-ch
推薦度:
標簽: 區別 的區別 差別
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 东乌| 马公市| 桂林市| 辽中县| 屏东县| 石泉县| 肇州县| 炎陵县| 禄丰县| 九龙城区| 新田县| 黔西| 中宁县| 宜黄县| 太康县| 庆元县| 越西县| 巧家县| 宜都市| 常熟市| 盘山县| 北宁市| 方山县| 冀州市| 板桥市| 江达县| 西畴县| 黎城县| 临漳县| 嘉义县| 泰宁县| 玉山县| 淳化县| 云南省| 博罗县| 尤溪县| 定州市| 四会市| 体育| 长丰县| 莒南县|