abouolia / sticky-sidebar

😎 Pure JavaScript tool for making smart and high performance sticky sidebar.
https://abouolia.github.io/sticky-sidebar/
MIT License
2.23k stars 489 forks source link

StickySidebar not defined, Uncaught SyntaxError: Unexpected token 'export' #112

Open itsanolive opened 4 years ago

itsanolive commented 4 years ago

Using Shopify, installed the on-page javascript and linked to the sticky-sidebar.js, updated css as directed, but so far it's not working and I'm getting 2 console errors related to the script:

  1. StickySidebar not defined
  2. Uncaught SyntaxError: Unexpected token 'export' - sticky-sidebar.js:738 (the very end of the sticky-sidebar.js file)
itsanolive commented 4 years ago

When I use jquery, the sidebar disappears - it's affixing the sidebar to the top of the page content, not the viewport. So when you scroll to the breakpoint, the sidebar disappears, because it's jumping up above the current viewable area.

xThuby commented 4 years ago

Bump

jameswadsworth commented 4 years ago

Same here: SyntaxError: export declarations may only appear at top level of a module sticky-sidebar.js:738:2 and therefore the browser doesn't load the js file and there is nothing to reference.

Lord-Me commented 4 years ago

Same over here. I'm getting an Unexpected token 'export' meaning the javascrypt piece in my page is not recognizing the constructor

TheBoop commented 4 years ago

I had this issue because I was grabbing the .js file from src folder. That is the pre-compile source code. Grab the same file from dist folder and it should be the distribution file

bencarafa commented 3 years ago

This worked for me: just use it with pure js, hence comment out that line with 'export'. After this you won't be able to use it with jQuery.