Created
September 13, 2011 16:16
-
-
Save madrobby/1214235 to your computer and use it in GitHub Desktop.
Get Safari (Lion) to hopefully always indicate & show scrollbars correctly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CoffeeScript source | |
$.fn.forceScrollbars = -> | |
@css position: 'static' | |
@[0].offsetHeight if @length > 0 | |
@css position: 'relative' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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
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.