$(document).ready(function() {
    
        $("a[href*='#']").click(function() {
            
            if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            
                var hash = $(this).attr('href').split('#');
                $('html,body').animate(
                                       {scrollTop: $('#' + hash[1]).offset().top},
                                       500,
                                       'linear',
                                       function() {
                    
                                            $('#' + hash[1]).fadeTo('fast', 0.80);
                                            $('#' + hash[1]).fadeTo('fast', 1);
                    
                                        }
                                       );
                
                return false;
            
            };
            
        });
});