Thanks to CSS Tricks, I changed the existing SmoothScroll code that came with the site to the following which worked:
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=" + this.hash.slice(1) +"]');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
Related Posts:
- jQuery equivalent of JavaScript’s addEventListener method
- How to send multiple data fields via Ajax?
- Adding an onclick function to go to url in JavaScript?
- Checking a Url in Jquery/Javascript
- When and why to ‘return false’ in JavaScript?
- Jquery Ajax Posting JSON to webservice
- How can I display a tooltip message on hover using jQuery?
- How is JavaScript .on() method defined?
- JQuery: $.get is not a function
- Bootstrap carousel not sliding
- How can I expand and collapse a using javascript?
- jQuery: using a variable as a selector [duplicate]
- Slide right to left?
- jQuery – checkbox enable/disable
- How can I correctly format currency using jquery?
- How do I send this form's output to a new WordPress page?
- Annoying “JQMIGRATE: Migrate is…” in console after update to WordPress 4.5
- Update jquery version
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- Using the WordPress Media Library and returning the Attachment ID rather than URL?
- How to get a jQuery script to run on a page?
- WP set auth cookie using Ajax is not saved to browser
- Modify Custom Field in Media Library using JavaScript
- Best approach for loading a sidebar Only if the screen max-width is >900px?
- Localize variable for multiple Shortcodes
- ajax call in wordpress front end
- Comment form vaildation
- Enqueuing jQuery in plug-ins
- Script doesn’t load because of a javascript MIME type error
- javascript is not working on Event Submission?
- TinyMCE – TypeError: r is undefined
- WordPress audio player causing js error, mediaelementplayer is not a function
- Auto-detect javascript errors and warn theme user
- Heartbeat API: How to access data already enqueued?
- How to get a value from PHP in Jquery through Ajax
- Script for initializing JQuery Masonry for WordPress
- Combining media queries with image sizes
- Implementing lazy loading in homepage posts instead of pagination
- Jquery integration with my theme
- How to stop focus() in custom js from scrolling to footer?
- Is it possible to hide media details sidebar when wp.media popup is being opened?
- Getting post meta in the flex slider
- Correct way to write jQuery functions in WordPress
- Disable stored tags queries in admin page when posting a new post
- WordPress Comments – Rich Text
- SSL issues with WordPress site
- Limit filetype and wp media
- Register jQuery – OOP WP
- How to isolate code to the post edit screen
- Good Solution for Adding jQuery Tabs Anywhere Within WordPress?
- jQuery code not working in widgets page
- WordPress error when replacing local jQuery by externally-hosted
- Superfish Menu Not Loading
- Convert UL to dropdown list not working
- JQuery Counter Limit not working for WP Comment Textarea
- jQuery selectable() function won’t work in wordpress
- jQuery(selector) vs. $(selector)
- Null/undefined return in WordPress AJAX request
- How do I make Contact Form 7 pop up in thickbox? [closed]
- How To Include JavaScript Files Only In Single Posts?
- Determine image height within Fancybox
- How to use JQuery Marquee in WordPress?
- WordPress 3.2.1: jQuery is not defined, breaks Admin panel
- inner anchor scrolling with wordpress
- Bootstrap and jQuery error: $ is not defined
- Auto next upon clicking image without clicking Next button
- Doing Math with Gravity Forms List
- JQuery is not working after complete load of the page
- I am trying to load a Js Dynamic Audio Synth [closed]
- Uncaught ReferenceError: jQuery is not defined
- Remove button from page if viewed through Customizer
- Carousel Slider For Custom PHP Snippet Is Not Working
- Target a specific page/template in jQuery
- why does so many javascript libraries are loaded along with my website?
- Why does my media selection script write to ONLY the first input field?
- Multiple level category drop-down three levels is not working
- Modify the href attribute of tag dynamically in WordPress
- Move jQuery on *top* of footer
- JQuery and Javascript to pan image
- How to add JS snippet before closing tag?
- Show/Hide text after the first paragraph
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Responsive framework – edit child js
- Page keeps refreshing with Ajax form
- Check with jQuery value of checkbox from custom admin panel
- jquery issue in functions.php
- JS plugin script loading but not working
- WP Calendar Shortcode not working on my theme
- Hide input field when second input field is in focus
- WooCommerce – PrettyPhoto appending URL with #prettyPhoto
- Is it possible to append an external html file to my wordpress navigation?
- jscrollpane problem with my child theme
- Change image on post title hover (more than one instance) – Jquery
- How to fire jQuery after $(window).on(‘load’)
- I need a Pop up with description when i click an image
- My website si Blocked by google and warns the visitors that is Unsafe site
- how to make this work with jquery 1.12.4 [closed]
- Theme variation conflict with jquery select2 dropdown
- Generate dynamic ID’s for each accordion button
- Impossible to update jQuery version from 3.1.0