【问题标题】:Leaving page after lottie animation ends on elementor乐天动画在elementor上结束后离开页面
【发布时间】:2021-06-15 08:28:43
【问题描述】:

我正在使用 wordpress 和 elementor pro 开发一个网站。我正在使用 lottie 块,我正在尝试触发动画 onclick,当它结束时,我想加载另一个目标页面。

网站链接是:

https://tadan.altervista.org/

当您单击鸡蛋时,动画会按原样触发,但我不知道一旦结束如何离开页面。 因为没有选项可以在 lottie 上设置它,我猜我必须写几行代码,但我不知道如何以正确的方式进行。有没有人可以帮助我?

【问题讨论】:

    标签: javascript wordpress elementor lottie


    【解决方案1】:

    您可以为 https://tadan.altervista.org/leoventuras-new/ 此页面添加自定义 jquery 代码。

    1-)打开当前主题目录(wp-content>themes>你要选择当前主题)

    2-)打开functions.php文件

    3-)转到页面底部

    并粘贴此代码并尝试:

    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' );
    

    【讨论】:

      猜你喜欢
      • 2015-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多