- $('a').click(function(){
- $('html, body').animate({
- scrollTop: $( $(this).attr('href') ).offset().top
- }, 1000);
- return false;
- });
-
The script above works perfectly fine , but i have a question about the animate function() ,
why is it that we are selecting $('html,body') ?? i don't get it .
what i understand is that if i write the code as
- $('a').click(function(){
-
- scrollTop: $( $(this).attr('href') ).offset().top,
- 1000;
- return false;
- });
it will work just fine , Alas without any effect !
i understand that animate is being used to to add an effect , but just to repeat my question , why is 'html' and 'body ' being selected ?????