Title: Link triggering scroll event twice?
Last modified: July 20, 2022

---

# Link triggering scroll event twice?

 *  [csimula](https://wordpress.org/support/users/csimula/)
 * (@csimula)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/link-triggering-scroll-event-twice/)
 * Everything works fine, the offset, animation, everything. But when I click a 
   button to scroll to the ID, it scrolls, then goes to the top and scrolls again,
   effectively triggering the event twice.
 * What am I doing wrong?
 * thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Flink-triggering-scroll-event-twice%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/link-triggering-scroll-event-twice/#post-15844251)
 * Hello,
 * You’re not doing anything wrong. It seems that there’s another script in your
   theme that has its own page scrolling animation that’s messing with “Page scroll
   to id”.
 * The script is this:
 * `...themes/salient/js/init.js`
 * and the culprit function starts in line 18186.
 * To solve this, first try going to “Page scroll to id” settings and set “Prevent
   other scripts from handling plugin’s links selector(s)” field value to:
 * `#header-outer nav .sf-menu a`
 * Save changes and test.
 * If the above doesn’t solve the issue, you’ll have to add a small js script in
   your page template.
 * You can do this by editing your theme/child-theme `footer.php` add add the following
   in a new line, right above the closing body tag (`</body>`):
 *     ```
       <script>
       (function($){
       	$(window).on("load",function(){
       		$(".__mPS2id").parent("li").parent("ul").removeClass("sf-menu");
       	});
       })(jQuery);
       </script>
       ```
   
 * Save/update the file and test. Scrolling should work without up/down hiccups.
 * Let me know
    -  This reply was modified 3 years, 10 months ago by [malihu](https://wordpress.org/support/users/malihu/).
    -  This reply was modified 3 years, 10 months ago by [malihu](https://wordpress.org/support/users/malihu/).
    -  This reply was modified 3 years, 10 months ago by [malihu](https://wordpress.org/support/users/malihu/).

Viewing 1 replies (of 1 total)

The topic ‘Link triggering scroll event twice?’ is closed to new replies.

 * ![](https://ps.w.org/page-scroll-to-id/assets/icon-256x256.png?rev=1401043)
 * [Page scroll to id](https://wordpress.org/plugins/page-scroll-to-id/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/page-scroll-to-id/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/page-scroll-to-id/)
 * [Active Topics](https://wordpress.org/support/plugin/page-scroll-to-id/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/page-scroll-to-id/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/page-scroll-to-id/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [malihu](https://wordpress.org/support/users/malihu/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/link-triggering-scroll-event-twice/#post-15844251)
 * Status: not resolved