Support

Account

Home Forums Front-end Issues Use ACF field for timeOut

Unread

Use ACF field for timeOut

  • I want to use an ACF field as a variable for a timeOut delay value in jQuery.
    Instead of having a fixed time value (i.e 1000ml) I want to use this field to do that.

    I’m using the following code but I can’t manage to achieve the desired result.
    Am I calling the ACF field properly?

    $(".item").mouseleave(function() {
        var $element = $(this);
        var delay = "<?php echo the_field('delay', 41); ?>";
        timeout = setTimeout(function(){
            $element.css("opacity", 0);
        }, delay);
    });
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.