PeterPrakker PeterPrakker - 1 year ago 56
jQuery Question

Why do my menu items activate a scroll function?

I used the 'Page scroll to id' plugin for Wordpress to set up a one scroll page where the menu items let you scroll through the section. I noticed the animation wasn't working, which had been the case for a few other websites I worked on in the past. Strange enough, unchecking the option 'activate on menu-items' did the trick back then and made the animation work. However, this time is different. I checked the general forum for this plugin on to troubleshoot this and I later deactivated the plugin to try to make it work with a simple jQuery function.

After those attemps I noticed that the menu items were still letting me scroll through the page, even though I removed my function and deactivated the plugin. I cleared my browser cache and installed WP Super Cache to delete any cache from the website itself. Neither of these did the trick.

I have no idea what makes the menu items scroll through the page, but it overrides any workaround I attempted to get an animated scroll function. There aren't any plugins installed at this moment. Does anyone know what might be causing this?

I tried a couple of things:

  • I replaced the id's and urls of the menu items with something I didn't use before, but the buttons still made me jump, just to be sure it's no caching

  • After that, I checked the database, but couldn't find anything related

  • I did a complete reinstall of WordPress and the database, but left my own parent and child theme of twentysixteen in, the problem remained

  • I downloaded a clean twentysixteen and replaced the parent theme with it, the problem remained

  • Checked all files from the child theme just to be sure, but there's nothing that could cause this

This makes me think there now is a jump/scroll function in either the parent theme or the WP installation itself, which is weird because this shouldn't be standard. (let alone impossible to override)

Answer Source

Found the problem. The line wasn't there in the front-page.php, which is the obvious reason that no function in the footer worked. But it was also conflicting with the animation of the Page Scroll To ID plugin, which is very unexpected.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download