1
의견을 신고/신고하는 시스템을 만들고 싶습니다.클릭하여 팝업 링크를 클릭하여 정보를 채우십시오.
이 시점에서 나는 숨겨진 div 안에있는 필드와 클릭 된 "깃발"링크 옆에있는 div에있는 commentid를 보내고 있습니다.
<a class="flag" id="[email protected](item.ID)">flag</a>
이 내 JQuery와에 대한 :
$(".flag").click(function() {
var commentId = $(this).attr('id');
$("#comment-id-label").val(commentId);
//get the position of the placeholder element
var pos = ("#"+commentId).offset();
var width = ("#"+commentId).width();
//show the menu directly over the placeholder
$("#menu").css({ "left": (pos.left + width) + "px", "top": pos.top + "px" });
$("#menu").show();
});
<div style="position: absolute; display: none;" id="menu">
<input id="comment-id-label" type="text" value="" />
</div>
있지만 작동하지 않는 아이디어
나는 각각의 의견에 따라이 같은 뭔가를 (How to position one element relative to another with jQuery?에서 촬영)?
당신이 요소의 Z-INDEX를 확인해 봤어? – Nazariy
네, 게시 된 I 링크의 두 번째 대답을 사용하여이 작업을 수행했습니다. 플러스 다른 문제는 이미 id = menu와 다른 뭔가가있었습니다! 그래서 그것은 나에게 두통도주고 있었다!. – raklos