Skip to content

Instantly share code, notes, and snippets.

@ace4gi
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save ace4gi/9890595 to your computer and use it in GitHub Desktop.

Select an option

Save ace4gi/9890595 to your computer and use it in GitHub Desktop.
브라우저 scroll시 scoll 루트 요소 찾기
(function($) {
$.extend({
// jquery 브라우저 구분 코드 (jquery 1.8.3 버전의 jQuery.broswer)
// 아래의 코드가 필요하면 자신의 클래스에 붙여서 사용하면됨~!
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
browser : (function(){
function uaMatch( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
matched = uaMatch( navigator.userAgent );
var browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
return browser;
})()
});
window.$scrollRoot = (jQuery.browser.msie || jQuery.browser.mozilla || jQuery.browser.opera) ? $("html") : $("body");
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment