public
Last active

Get Safari (Lion) to hopefully always indicate & show scrollbars correctly

  • Download Gist
forceScrollbars.coffee
CoffeeScript
1 2 3 4 5 6
# CoffeeScript source
 
$.fn.forceScrollbars = ->
@css position: 'static'
@[0].offsetHeight if @length > 0
@css position: 'relative'
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// nudge safari 5.1 to (hopefully) display scrollbars correctly
 
(function() {
$.fn.forceScrollbars = function() {
this.css({
position: 'static'
});
if (this.length > 0) {
this[0].offsetHeight;
}
return this.css({
position: 'relative'
});
};
}).call(this);

Note: it works often, but not always, I still have some elements that just never show the Lion-style scrollbars, or any scrollbars ftm. Any ideas are welcome.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.