카테고리 없음
[javascript] Z- 색인이 가장 높은 DIV를 선택하세요.
행복을전해요
2021. 1. 6. 01:40
I'm sure you could use the stop event to gain access to the recently dragged item, i.e.:
$('.selector').draggable({
stop: function(event, ui) {
$(event.target).addClass('justDragged');
}
});
If you wish to see all functions/variables bound to event, you could use the following:
var str = '';
for (i in event) {
str += i + ', ';
}
alert(str);
This should give you a good indication of what's available to you in any number of jQuery callback params.
-------------------You can always test against jQuery(".yourDivs").css("z-index")
once you've added the class on all your divs.
귀하의 자리에서 각 div에 이벤트 onclick을 첨부합니다. Javascript 또는 jQuery가 자동으로 zindex 정보를 고려하고 클릭 한 DIV에서 정확히 이벤트를 얻을 것이라고 생각합니다.
-------------------.draggable에 '드래그 시작'이벤트가 있다는 것을 방금 알아 냈습니다. 내가 얼마나 어리석은가.
$ ( "# window-"+ id + ". staticwindow.stwin"). draggable ({ ... 시작 : function (e, u) { $ ( ". window"). removeClass ( 'active'); $ (this) .addClass ( 'active'); } });
이 접근 방식은 더 이상 내 원래 질문과 관련이 없지만 적어도 반복은 없습니다. 이것은 루프가 필요한 것 같기 때문에 어떤 대답도 받아들이지 않을 것입니다. (사르코 오의 대답을 받아들이는 경향이 있지만 사건에 대해 생각하게 되었기 때문에)
귀하의 답변에 감사드립니다!
출처
https://stackoverflow.com/questions/2005804