Reputation: 2545
I'm using a third party script (details below) to break up a form into multiple ajax'd pages. When I click to advance to the next page, it jumps to an anchor on the top of the form. This is an unnecessary and jarring behavior and I'd like to prevent it from happening. I didn't write this script and cannot modify it directly. Is there a way that I can intercept and disable the anchor/scrollto call?
A bit about my setup: This is a Drupal 7 site. I have an Entityform using multipage Field Groups with two pages. jQuery is available.
Here's an illustration of what happens. You can see the original page on the left as it's loaded. On the right, you can see what happens after you click "Next Page". It anchors to the top of the form. I've circled the last line of text on each so you can see the jump. (Worth noting, the site's nav bar stays fixed at the top when you scroll.)
How can I prevent this anchor jump?
Upvotes: 0
Views: 123
Reputation: 11
In your JS function for clicking in 'next page' put return false at the end of the function.
Like
function click() {$('.nextpage').css('display', 'block'); return false;}
It will work fine.
Upvotes: 1