Jump to content
Search Community

utopian last won the day on January 1 2022

utopian had the most liked content!

utopian

Business
  • Posts

    13
  • Joined

  • Last visited

  • Days Won

    1

Community Answers

  1. utopian's post in ScrollSmoother outside react not working on ScrollTriggers inside react components was marked as the answer   
    You can go ahead and ignore this. I realized all I had to do was export my ScrollSmoother and import it into my react component. It's fixed now.
  2. utopian's post in how to add gsap animations to WordPress was marked as the answer   
    First off, if you are working on WordPress and editing themes. You should always create a child theme to make customizations on. It's bad practice to customize your parent theme (or just theme) because if the author of the theme updates their theme and you update it, you will lose all your customizations. If you make customizations on a child theme, you will then be able to safely update the parent theme without losing all your work.
     
    Now to help you enqueue.
     
    Your code should look like this:
     
    function wpb_adding_scripts(){ wp_register_script( 'gsap', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js', array(), '1.0', true ); wp_register_script( 'gsap-settings', get_stylesheet_directory_uri() .'/gsap-options.js', array('gsap'), '1.0', true ); wp_enqueue_script('gsap'); // This is probably not needed since below we are enqueueing the gsap-settings file with has a dependency on the gsap script, so it should enqueue both wp_enqueue_script('gsap-settings'); } add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );  
    This would then enqueue the script properly I believe (haven't tested it but pretty sure it should stop the error).
     
    I also added a gsap-settings script, which you can create that js file in your theme at the correct location and write all your animation in there and call gsap. Hopefully this helps!
×
×
  • Create New...