Use gsap (greensock)


#1

Hi,
i’m testing blocs, and i’m trying to use gsap with blocs, but still not working…
i’ve added the script code in page settings and added a JS file to header file attachments, made some tests… nothing moves…


#2

Hi Andre,

Welcome to Blocs and the Forum.

You should be fine using it, with a few covets to be aware of.

Even though the documentation states this…

https://help.blocsapp.com/view-modes/

“In preview mode you can experience your website the way you would when it’s viewed within a web browser. All interactions, animations and videos will work as you would normally expect.”

1.] As far as I know Blocs internal “Preview Mode” does not execute Javascript when it is added to the page (even the most basic alert test fails). Or correctly me if I am wrong @norm, but it appears that is currently the case. Hopefully that may change in Version 3, so when in “Preview Mode” it will be a full representation in app.

2.] The other thing is make sure you are targeting the correct name (ID / Class / etc) for your selector . Be aware that Blocs changes ID’s and Class names to all lowercase vs allowing camelCase. In case you happen to be using that in your script. It also does not see the difference between a hyphen and underscore and thinks it is the same and already in use (some-id / some_id) @norm. But does allow it for classes (someclass, some-class, some_class). So be mindful of your naming and selectors across your project. Naming conventions can be a topic unto itself, including various debates about it.


So yes GSAP will work, but be sure to “Preview in Browser” to see any results. Also remember to be mindful of your naming and referencing. Otherwise it could be something to do with your script or other facets as to why you may be having issues.