/chromeSmoothScroll

Smooth scrolling for chrome browser

Primary LanguageJavaScript

chromeSmoothScroll

Smooth scrolling for chrome browser (it's less than 2 KB)

usage

Just inlcude the js, you are done!

<script src="path/to/chromeSmoothScroll.js"></script>

demo

http://habibhadi.com/demo/chromeSmoothScroll/

Tips

If you want to turn smooth scrolling for specific OS then you may try like this -

var OS = {
    isWindows: function(){ return navigator.appVersion.indexOf("Win")!=-1 },
    isMac: function(){ return navigator.appVersion.indexOf("Mac")!=-1 },
    isUnix: function(){ return navigator.appVersion.indexOf("X11")!=-1 },
    isLinux: function(){ return navigator.appVersion.indexOf("Linux")!=-1 },
    name: function(){
        var name = '';
        if(OS.isWindows()) name = "windows";
        else if(OS.isMac()) name = "macosx";
        else if(OS.isUnix()) name = "unix";
        else if(OS.isLinux()) name = "linux";
        return name;
    }
};


if( OS.name() == 'windows' ) {
    // this function called at the end of the js file!
    chromeSmoothScroll.init();
}