abstract:
$('html,body') .animate({scrollTop: targetOffset}, 1000);
return false;
}
}
});
});
</script>
Code:
<a href="#" class="link">top of page</a>
Any ideas why it doesn't work in Firefox, Chrome or Safari (all latest versions) - just does the straight to top job
Cheers,
TD
Have a good Xmas all of you!
Hey,
I've placed this on pages where a ^ top of page link at the bottom is present which animates a scroll back to the top of page, however it only seems to work in IE...
Code:- <script language="JavaScript" type="text/javascript" src="_include/_scripts/jquery.js"></script>
- <script language="javascript" type="text/javascript">
- $(document).ready(function(){
- $('a[href*=#]').click(function() {
- if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
- && location.hostname == this.hostname) {
- var $target = $(this.hash);
- $target = $target.length && $target
- || $('[name=' + this.hash.slice(1) +']');
- if ($target.length) {
- var targetOffset = $target.offset().top;
- $('html,body') .animate({scrollTop: targetOffset}, 1000);
- return false;
- }
- }
- });
- });
- </script>
Copy Code Code:- <a href="#" class="link">top of page</a>
Copy Code Any ideas why it doesn't work in Firefox, Chrome or Safari (all latest versions) - just does the straight to top job
Cheers,
TD
Have a good Xmas all of you! |