View Full Version : ScrollTop working in IE/FF but not in Safari

12-03-2009, 08:59 PM
Hi all,

The following script is scrolling my page smoothly, as it is supposed to, in IE and FF however it is not working at all in Safari, any version. The page is:


When working correctly, you click the nav buttons in the left sidebar, the page scrolls to the appropriate section.

The script:


$('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-100;

$('html,body').animate({scrollTop: targetOffset}, 1000);

return false;





Any help would be greatly appreciated. Thanks

12-03-2009, 09:40 PM
check your "doctype"

12-17-2009, 08:43 PM
hey, thanks for responding, what should I be looking for in my doctype?

right now it is transitional