Can't change z-index with JQuery

后端 未结 5 1431
别跟我提以往
别跟我提以往 2020-12-10 10:29

I, for some reason, can\'t change the zIndex of an element using jQuery. I\'ve searched all of this website and Google but couldn\'t find the right answer. I am trying to

5条回答
  •  误落风尘
    2020-12-10 11:04

    Setting the style.zIndex property has no effect on non-positioned elements, that is, the element must be either absolutely positioned, relatively positioned, or fixed.

    So I would try:

    $(this).parent().css('position', 'relative');
    $(this).parent().css('z-index', 3000);
    

提交回复
热议问题