Skip to content

Instantly share code, notes, and snippets.

@jxson
Forked from madrobby/forceScrollbars.coffee
Created September 13, 2011 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jxson/1215488 to your computer and use it in GitHub Desktop.
Save jxson/1215488 to your computer and use it in GitHub Desktop.
Get Safari (Lion) to hopefully always indicate & show scrollbars correctly
# CoffeeScript source
$.fn.forceScrollbars = ->
@css position: 'static'
@[0].offsetHeight if @length > 0
@css position: 'relative'
// 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment