[jQuery] trouble with offset();
I have this code here and i am trying to get the offset of element.
the idea is that i will eventually be able to make it hook - right now
i just want it to get the position. everthing else works... just not
the positioning.
can anyone help me fix that?
(function($){
$.fn.extend({
bstip: function() {
return this.each(function(i){
var nowid=$(this).id, nowtitle=$(this).attr("title");
here=$(this);
//Math Vars
var offset = here.offset();
nowidth=$(this).width();
nowheight=$(this).height();
$("body").append("<div class='bstip' id='bs"+i
+"'>"+nowtitle+"
</div>");
$('#bs'+i).css({"top":offset.top+"px","left":offset.left
+"px","position":"absolute"});
$('#bs'+i).append("poop");
var bs_tooltip = $("#bs"+i);
$(this).removeAttr("title").mouseover(function(){
bs_tooltip.css({"opacity":.8}).fadeIn("fast");
}).mouseout(function(){
bs_tooltip.fadeOut("fast");
});
});
}
});
})(jQuery);