Title: Loading assets conditionally (CSS/JS)
Last modified: July 14, 2023

---

# Loading assets conditionally (CSS/JS)

 *  Resolved [Gyurmey](https://wordpress.org/support/users/gyurmey/)
 * (@gyurmey)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/loading-assets-conditionally-css-js/)
 * Hey, thanks for the great plugin!
 * Is it possible for CSS/JS to load on the frontend only when an animation is used?
   Now it always loads whether there is an animation or not.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [websevendev](https://wordpress.org/support/users/websevendev/)
 * (@websevendev)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/loading-assets-conditionally-css-js/#post-16898134)
 * Added in 1.1.2, you should find an option for it here:
 * ![](https://i0.wp.com/user-images.githubusercontent.com/18283192/253789910-e554b829-
   04a3-4618-9f0b-1c1da5ce92bd.png?resize=276%2C345&ssl=1)
 * Note: if you’re not using a Full Site Editing theme then the blocks in post content
   are rendered after styles have already been added to the head, therefore the 
   AOS stylesheet will end up at the end of the body element, which may cause the
   animated element to be visible before animating in.
 * It’s also possible to simply disable the assets using the filters [here](https://github.com/websevendev/animations-for-blocks/blob/1d3303dd0e083eb7c44239fed5622e30d5eef46a/animations-for-blocks.php#L176-L184)
   and only enable them on the pages you need.
 *  Thread Starter [Gyurmey](https://wordpress.org/support/users/gyurmey/)
 * (@gyurmey)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/loading-assets-conditionally-css-js/#post-16898253)
 * Thank you very much! Now it works great!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Loading assets conditionally (CSS/JS)’ is closed to new replies.

 * ![](https://ps.w.org/animations-for-blocks/assets/icon-256x256.png?rev=2587511)
 * [Animations for Blocks](https://wordpress.org/plugins/animations-for-blocks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/animations-for-blocks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/animations-for-blocks/)
 * [Active Topics](https://wordpress.org/support/plugin/animations-for-blocks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/animations-for-blocks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/animations-for-blocks/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Gyurmey](https://wordpress.org/support/users/gyurmey/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/loading-assets-conditionally-css-js/#post-16898253)
 * Status: resolved