【问题标题】:is $.index() equivalent of nth-child?$.index() 是否等同于第 n 个孩子?
【发布时间】:2013-12-15 23:01:58
【问题描述】:

的返回值
$(element).index();

与 CSS nth-child(index) 兼容?

我做了一些测试,看起来确实如此。有人可以确认吗?

【问题讨论】:

    标签: javascript jquery css indexing css-selectors


    【解决方案1】:

    不...index() 是基于0 的索引,而nth-child 使用基于1 的索引

    演示:Fiddle

    【讨论】:

    • 其实,如果他回答了这个问题,你应该选择它作为答案。
    猜你喜欢
    • 2016-03-05
    • 2017-03-11
    • 2016-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-06
    • 1970-01-01
    相关资源
    最近更新 更多