Skip to content

Instantly share code, notes, and snippets.

@tanatana
Created January 17, 2014 22:31
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 tanatana/8482881 to your computer and use it in GitHub Desktop.
Save tanatana/8482881 to your computer and use it in GitHub Desktop.
/*
* jQuery hasScrollBar plugin ver 0.0.1
* Copyright (c) 2014 tanatana (a.k.a @side_tana)
* This source file is subject to the MIT license.
*/
(function($) {
$.fn.hasScrollBarY = function(options){
var innerWidth = this.innerWidth();
var clientWidth = this[0].clientWidth;
if(innerWidth == clientWidth){
return false;
}
return true;
};
$.fn.hasScrollBarX = function(options){
var innerHeight = this.innerHeight();
var clientHeight = this[0].clientHeight;
if(innerHeight == clientHeight){
return false;
}
return true;
};
$.fn.hasScrollBar = function(options){
return {x: this.hasScrollBarX(), y: this.hasScrollBarY()};
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment