Leaving page after lottie animation ends on elementor

Viewed 175

Im developing a website using wordpress and elementor pro. I'm using a lottie block and i'm trying to trigger an animation onclick and when it ends i'd like to load another targeted page.

the website link is:

https://tadan.altervista.org/

when you click on the egg the animation is triggered as it should be, but i have no idea how to leave the page once it's over. since there's no option to set this on lottie, im guessing i have to write a few lines of code but I dont know how to do it in the proper way. Is there anyone who can help me?

1 Answers

You able to add custom jquery code for https://tadan.altervista.org/leoventuras-new/ this page.

1-)Open the current theme directory(wp-content>themes> you have to select current theme)

2-)Open functions.php file

3-)Go to page bottom

And paste this code and try:

function my_footer_scripts(){
global $wp;
$current_url = home_url($_SERVER['REQUEST_URI']);
if ($current_url=='https://tadan.altervista.org/leoventuras-new/'){
    echo  "
    <script>
    setTimeout(function (){
        window.location.href='another-page-url'
    },2000)
    </script>
    
    "; /* 2000 is 2 seconds. If you want change it */
  }
 }
add_action( 'wp_footer', 'my_footer_scripts' );
Related