Javascript scroll to div -
i have 2 issues i'm wrestling @ moment. i'm trying use javascript jump id on page (i slow animation js gives). javascript using though isn't working though. here's js fiddle i'm working on:
here code(sorry long html, had use testing scrolling):
html:
<section id="thumbs-work"> <img id="top-cat" src="images/cat.png"> <p> /* large amount of text force scrolling */ </p> </section> <div class="back-to-top back-to-top-left"> <p><a> <span class="top-jump">back top</span><img src="images/cat.png" alt="back top"></a></p> </div> </div>
javascript:
$( document ).ready(function() { $(".top-jump").click(function() { $("html, body").animate({ scrolltop: $("#top-cat").offset().top }, 1000); return true; }); });
any appreciated
it's because didn't load jquery in jsfiddle. it's in upper left, under frameworks & extensions.
Comments
Post a Comment