trackpad-scroll-emulator
trackpad-scroll-emulator copied to clipboard
fire fox not returning $el.width() correctly
sometimes with firefox : if .tse-content has a lot of nested elements and *{box-sizing: border-box;} jQuery will not return return the width correctly and ends up showing 10px of the hidden moz scrollbar.
work around in function resizeScrollContent() change $scrollContentEl.width($el.width() + scrollbarWidth()); to $scrollContentEl.width(parseInt($el.css('width'))+scrollbarWidth());
Do you have a demo I can use to reproduce this issue?
@jnicol its a known limitation of jQuery. why they haven't fixed it yet is probably to avoid bc breaks for applications that may already work around this problem. i use instead:
$.fn.realWidth = function(){ return ~~$(this).css('width').replace(/px/,''); };
$.fn.realHeight = function(){ return ~~$(this).css('height').replace(/px/,''); };
which will force jQuery to calculate the width/height including padding, regardless of the value of box-sizing for the element. box-sizing is what causes this problem.