Which is more efficient: .parent().parent().parent() ~or~ parents(“.foo”) ~or~ closest(“.foo”)

前端 未结 7 1815
-上瘾入骨i
-上瘾入骨i 2020-12-15 03:06

I have an A tag which triggers the animation of it\'s great-great-great-grandparent. All of the following will work, but which is most efficient, and why?

$         


        
7条回答
  •  心在旅途
    2020-12-15 04:01

    You also can use parents('.foo:first'). I guess is pretty much the same as closest().

提交回复
热议问题