Jquery 在IE中滚动时未重新计算偏移量
我在一家新公司开始工作,他们给了我一些在IE中出现的jQuery。出于某种原因,工具提示的位置不会在你只在Internet Explorer中上下滚动页面时重新计算。文件中有很多内容,但我认为这是最有帮助的部分:Jquery 在IE中滚动时未重新计算偏移量,jquery,internet-explorer,scroll,tooltip,offset,Jquery,Internet Explorer,Scroll,Tooltip,Offset,我在一家新公司开始工作,他们给了我一些在IE中出现的jQuery。出于某种原因,工具提示的位置不会在你只在Internet Explorer中上下滚动页面时重新计算。文件中有很多内容,但我认为这是最有帮助的部分: reposition: function (target, tip, classes) { var width, nub, nubHeight, nubWidth, row, objPos; tip.css('visibi
reposition: function (target, tip, classes) {
var width, nub, nubHeight, nubWidth, row, objPos;
tip.css('visibility', 'hidden').show();
width = target.data('width');
nub = tip.children('.nub');
nubHeight = nub.outerHeight();
nubWidth = nub.outerWidth();
objPos = function (obj, top, right, bottom, left, width) {
return obj.css({
'top': top,
'bottom': bottom,
'left': left,
'right': right,
'width': (width) ? width : 'auto'
}).end()
};
objPos(tip, (target.offset().top - tip.outerHeight() - nubHeight), 'auto', 'auto', target.offset().left, width);
objPos(nub, 'auto', 'auto', -nubHeight, 'auto');
<!--Some code here only if the window is less than 767px-->
show: function ($target) {
var $tip = methods.getTip($target);
methods.reposition($target, $tip, $target.attr('class'));
$tip.fadeIn(150)
},
所以它在IE中工作(耶),但现在它在Firefox和Chrome中关闭了。我越来越近了。我能感觉到。如果有人能在这一点上帮助我,我将不胜感激,否则我将在时间允许的情况下着手解决
更新2:我现在更新了我的pageTop变量:
pageTop = $('html').scrollTop();
这在IE8和Chrome中都可以使用,但可惜的是,Firefox不喜欢它。我也试过了
pageTop = $('body,html').scrollTop();
但它也没什么作用,而且时间更长,所以我把它拿了出来
战斗仍在继续 何时调用
重新定位
?你确定它真的被调用了吗?@JamesMontagne,我编辑了我的代码来显示它被调用的位置。谢谢
pageTop = $('body,html').scrollTop();