• Resolved moek93

    (@moek93)


    hello guys i need your help please i want the video play on hover and to stop when the mouse is out i have added a code in functions.php but still not working I’m new to PHP and java script so any help would be appreciated thanks! the code added is :

    function custom_video_preview(){
    ?>
     <script>
    var figure = jQuery(".video").hover( hoverVideo, hideVideo );
    
    function hoverVideo(e) {  
        jQuery('video', this).get(0).play(); 
    }
    
    the class i have gived to the videos in elementor is video 
    
    function hideVideo(e) {
        jQuery('video', this).get(0).pause(); 
    }
     </script>
    <?php
    }
    add_action('wp_footer', 'custom_video_preview');

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘play video on hover’ is closed to new replies.