-2

I'm using the onClick function.

How can I use onClick to scroll to an element or id of a div in a scrollable div using Jquery?

An example of how to do this would be very helpful.

Metalskin
  • 3,998
  • 5
  • 37
  • 61

1 Answers1

0

You can used this:

$("element").click(function() {
    $('div').animate({
       scrollTop: $("#elementtoScrollToID").offset().top
    }, 1000);
});

But if you want some advice specifically have to give an example

Pesulap
  • 884
  • 8
  • 19