Is there a way in jQuery to bring a div to front?

后端 未结 6 1328
渐次进展
渐次进展 2020-12-29 20:42

If I had a bunch of absolute positioned divs and they overlapped, how would I get a certain div to come to the front? Thanks again guys!

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 21:09

    This is a CSS thing, not a jQuery thing (though you can use jQuery to modify the css).

    $('element').css('z-index', 9999);  // note: it appears 'zIndex' no longer works
    

    Or, absolute positioning will bring something to the top:

    $('element').css('position', 'absolute');
    

提交回复
热议问题