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

后端 未结 6 1350
渐次进展
渐次进展 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:01

    With jQuery (like you asked):

    $('#a-div').parent().append($('#a-div')); // Pop a div to the front
    

    Weird how everyone went with z-index. Why override natural stacking order when you can just pop it to the front within the DOM?

提交回复
热议问题