Created
February 19, 2013 15:18
-
-
Save onozaty/4986781 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function show(target) { | |
var div = document.createElement('div'); | |
div.appendChild(document.createTextNode('xxxx')); | |
div.style.border = 'solid 1px black'; | |
div.style.zindex = 100; | |
// 対象と同じ親に追加 | |
target.parentElement.appendChild(div); | |
// 親ボックスからの絶対指定 | |
div.style.position = 'absolute'; | |
// 親ボックスからの位置は、対象と同じ位置から、 | |
// 下に向かって対象の高さ分ずらす | |
div.style.top = (target.offsetTop + target.offsetHeight) + 'px'; | |
div.style.left = target.offsetLeft + 'px'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment