delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
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:
  1.         <script language="JavaScript" type="text/javascript" src="_include/_scripts/jquery.js"></script>
  2.         <script language="javascript" type="text/javascript">
  3.                 $(document).ready(function(){
  4.                         $('a[href*=#]').click(function() {
  5.                                 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
  6.                                 && location.hostname == this.hostname) {
  7.                                         var $target = $(this.hash);
  8.                                         $target = $target.length && $target
  9.                                         || $('[name=' + this.hash.slice(1) +']');
  10.                                         if ($target.length) {
  11.                                                 var targetOffset = $target.offset().top;
  12.                                                 $('html,body') .animate({scrollTop: targetOffset}, 1000);
  13.                                                 return false;
  14.                                         }
  15.                                 }
  16.                         });
  17.                 });
  18.         </script>
Copy Code
Code:
  1. <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!

TOP

Do you get any errors in Chrome's javascript debugger (ctrl+shift+j), or perhaps Firefox's error console?



                                                $('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!

TOP

Back Forum