I am on Drupal 7.

I have a Views block with a pager sitting on the bottom part of it. I am using AJAX pager, meaning the page isn't reloaded. When the pager is clicked, the block reloads all the elements inside of it to display elements on the second page. But because my block is kind of long, when the pager is triggered, I would like to take my user again to the top of the block. I can do that with an anchor that will slowly scroll the page to the anchor that sits on top of that block. There is no issue with this. My doubt is: how can I add a javascript listener that will capture a Views AJAX pager click so that my code can be executed? What is the right Drupal way of doing this? Thank you so much.

  • Could you edit the question and add the code you're using, along with what specifically isn't working? We don't have a code writing service here so it's important you show what you've already tried, and we can help you debug it. Thanks
    – Clive
    Commented Nov 9, 2013 at 13:40

1 Answer 1


In ajax view, by default this functionality is already there. When you click on ajax pager it will automatically scroll to top of content. If it is not working check your console for is there any error showing.

  • Thanks, ARUN. This is weird, that behavior isn't triggered on my version. Maybe I will upgrade the module and check if it is being done. I will check it and let you know. Commented Nov 11, 2013 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.