javascript - jQuery Uncaught TypeError: Cannot read property 'top' of undefined -
i keep getting following error : uncaught typeerror: cannot read property 'top' of undefined
the issue relates line: posy = pos.top - $(window).scrolltop(),
although it's not damaging bit of pain see.
i have tried contents using : var postest = inf.offset().top;
ends happening instead offset error.
any ideas appreciated.
$(document).on("mouseenter", ":has('.infotip.ifixed')", function() { var inf = $(".infotip.ifixed"); if (inf.length) { var itheight = $(this).children(".infotip").innerheight(), pos = $(this).children(".infotip").parent().offset(), posy = pos.top - $(window).scrolltop(), posx = (pos.left - $(window).scrollleft()) + 190, accuheight = (posy - itheight) + 150, divpos = { left: posx, top: accuheight }; $(this).find(".infotip.ifixed").css(divpos); } });
my definition inf
wrong.
$(document).on("mouseenter", ":has('.infotip.ifixed')", function() { var inf = $(this).children(".infotip").parent(); if (inf.length) { var postesty = inf.offset().top, postestx = inf.offset().top; var itheight = $(this).children(".infotip").innerheight(), posy = postesty - $(window).scrolltop(), posx = (postestx - $(window).scrollleft()) + 190, accuheight = (posy - itheight) + 150, divpos = { left: posx, top: accuheight }; $(this).find(".infotip.ifixed").css(divpos); } });
Comments
Post a Comment