0
클릭 할 때 세션에서 일부 값을 제거하려고 시도하고 있지만 다시로드 할 때 클릭하지 않고 트리거되는 것처럼 보입니다.레일로드시 JS 위임 이벤트가 트리거됩니까?
이 내 코드 (커피 + ERB)입니다 : 세션을 다시로드 한 후
$(document).on "click", ".top-bar[data-chatbox-id='<%=chat.id%>'] .fa-times", (e) ->
$box_position = $("div.chat_box[data-chatbox-id='<%=chat.id%>']").position().left
$("div.chat_box[data-chatbox-id='<%=chat.id%>']").remove()
## ################### LINE BELOW IS THE ONE CAUSING PROBLEMS #######
<% session[:chatrooms].delete(chat.id) %>
chats = $('.chat_box')
chats.each (index, element) =>
if $(element).position().left < $box_position
$(element).css('right', '-=' + 310 + 'px')
이 지워지지 것 - 그것은 단지 클릭에 트리거되지해야합니까? 하지만 이전 사용하여 선택한 요소 생성 "선택기가 null 또는 생략되는 경우에는 선택 요소에 도달 할 때, 이벤트가 항상 트리거됩니다.": : 내 마음에 오는
있는 유일한 방법이다
을$(document.body).append("<%= j render '/chatrooms/chatroom' %>")