Select DIV with highest z-index

后端 未结 4 1547
遇见更好的自我
遇见更好的自我 2021-01-18 09:50

Example code so I can start explaining this problem:

5
2
4条回答
  •  执念已碎
    2021-01-18 10:41

    I just figured out that there's a 'start dragging' event in .draggable. How silly of me.

    $("#window-"+id+".staticwindow.stwin").draggable({
    ...
        start: function(e, u){
            $(".window").removeClass('active');
            $(this).addClass('active');
        }
    });
    

    Although this approach of mine is not related to my original question anymore, atleast there's no looping. I'm not going to accept any answer because this seems to need a loop. (Although I'm slightly inclined to accept the answer by zarko-o because it lead me to think on events)

    Thanks everyone for your answers!

提交回复
热议问题