Interactions and observers not working with appfairy
See original GitHub issueI wasn’t able to see any of my js scripts run on my pages when I ran the appfairy command. It seems like the issue was that appfairy renames all classes on the html files with “af-class-yourclass” so then the js file cannot attach to those after.
A quick workaround, a little time consuming but works:
Just search for selectors on bottom of webflow js file and add “af-class-” to them. i.e. “.thisClass” to “.af-class-thisClass”
They are all within these 2 initializer functions at the bottom of the Webflow generated script: Webflow.require(‘ix’).init(…)
Webflow.require(‘ix2’).init(…)
Also, I don’t know if its because I am rendering the pages on the server with NextJS, but I also had to add some attributes to my html tag for other animations to work correctly using:
var doc = document.getElementsByTagName("html")[0] doc.setAttribute('data-wf-page', 'yourPageID') doc.setAttribute('data-wf-site', 'yourWebflowSiteID') //optional for language doc.setAttribute('lang', 'en')
Also, with nextJS I had to wrap these two initializer functions so they would only run on client side and not give me a “document not defined” when compiled on server using:
$( document ).ready(function() {}
Hope this saves someone else a day of debugging!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:9 (3 by maintainers)
Top GitHub Comments
I’ve added native support for that in version 0.8.0. It will work out of the box now
How did this turn out?