-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interactions and observers not working with appfairy #7
Comments
@jayb967 Appfairy renames the classes and for a good reason - it saves potential conflicts when attaching additional stylesheets, because Webflow uses extremely generic rules. Appfairy shouldn't rename elements which start with a |
Yes I understand the webflow class name change which is ok, but a lot of interactions made on webflow are not called on the html new class name "af-class-.." from the generated js file. For instance here is a small snippet of my webflow generated interaction inside my js folder, after using the appfairy command: |
I guess I'll add an option to disable encapsulation but I truly don't like how webflow assumes it's the only thing that matters... |
How did this turn out? |
Hi, i also have this issue. Renamed classes according to your answers, yet still not working. |
Hi I am having the same issue. @DAB0mB Do we have an option to disable encapsulation / renaming of the classes? This is an example of a webflow site with animations that won't work on Appfairy: |
Thanks for your tips @jayb967 I've created the following script to convert the json events inside Webflow.require('ix2').init(...):
I had also to modify my index.js file to look like this:
@DAB0mB Any chances of incorporating the above in Appfairy? |
Wow thanks for writing Appfairy @DAB0mB and thanks for the tips @ronaldocpontes @jayb967! I wrote up a summary of what I learned while facing these issues here. Here is a little bash script that automates the application of the node script ronaldocpontes wrote:
Also if someone is facing issues with on page load interactions, I think it's a problem with Webflow -> React, not Appfairy. My work around was to make it an
|
I've added native support for that in version 0.8.0. It will work out of the box now |
I 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!
The text was updated successfully, but these errors were encountered: