0

I am trying to implement smoothscroll polyfill on my site.

https://github.com/iamdustan/smoothscroll

I have enqueued the script which I can see loading, but it does not work.

wp_enqueue_script('smooth_js', get_stylesheet_directory_uri() . '/js/smoothscroll-polyfill.js', array(), '1.0.0', true);

I also tried adding jquery as a dependency but that made no difference.

There are instructions that say:

Download the production ready file here and include it in your project, or install it as a package.

If you are importing it as a dependency, make sure to call the polyfill method:

import smoothscroll from 'smoothscroll-polyfill';

// kick off the polyfill!
smoothscroll.polyfill();

I don't understand what this means and where I would place this code (if I even need to). I tried functions php but the site goes down.

I already implemented zen scroll which worked perfectly but not when scrolling to anchor links from other pages.

What am I missing here?

Mr Toad
  • 202
  • 2
  • 12
  • 41

0 Answers0