jQuery .each css is not a function

后端 未结 3 1548
走了就别回头了
走了就别回头了 2021-01-13 07:09

I have an jQuery object with 3 members:

var elements = $(\"#\" + this.wrapperName + \">ul>li>a>img\");
Object { 0: , 1: , 2         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-13 08:06

    You have to use $(this) selector inside the each loop

    elements.each(function(index, element) {
        $(this).css({
            "width": elemWidth,
            "height": elemHeight,
            "top": elemTop,
            "left": elemLeft
        });
    }
    

提交回复
热议问题