편집 요약 없음 |
편집 요약 없음 |
||
21번째 줄: | 21번째 줄: | ||
var iterWidth = $(iter).width(); | var iterWidth = $(iter).width(); | ||
var where_top = $(iter).offset().top+15; | var where_top = $(iter).offset().top+15; | ||
var where_left = $(iter).offset().left-baloonWidth; | var where_left = $(iter).offset().left+iterWidth-baloonWidth; | ||
$(baloon).css("top",where_top); | $(baloon).css("top",where_top); |
2015년 5월 31일 (일) 13:14 판
var ref_tags = $("[id^=cite_ref]");
$(ref_tags).each(function(index ,iter)
{
var a = $(iter).children("a")[0];
var ref_text = $($(a).attr("href")).children(".reference-text")[0];
var ref_text = $(ref_text).html();
var baloon = document.createElement("div");
var arrow = document.createElement("div");
var inner = document.createElement("div");
baloon.className = "tooltip bottom fade";
arrow.className = "tooltip-arrow";
inner.className = "tooltip-inner";
$(inner).html(ref_text);
$(baloon).append(arrow);
$(baloon).append(inner);
$('body').after(baloon);
var baloonWidth = $(baloon).width()/2;
var iterWidth = $(iter).width();
var where_top = $(iter).offset().top+15;
var where_left = $(iter).offset().left+iterWidth-baloonWidth;
$(baloon).css("top",where_top);
$(baloon).css("left",where_left);
console.log('넌 값이 얼마니'+where_top);
console.log('넌 값이 얼마니'+$(iter).offset().left);
iter.tooltip = baloon;
$(iter).hover(
function(e)
{
var bal = this.tooltip;
baloon.className = "tooltip bottom fade in";
},
function(e)
{
var bal = this.tooltip;
baloon.className = "tooltip bottom fade";
}
);
});