• Resolved david221

    (@david221)


    I’m trying to test my jQuery file onto my WordPress. What I want to is to delay a video from loading on the screen for half a second. This is what I’ve done so far.

    Underneath are the WP Enqueue Scripts included in my functions.php file:

    add_action ( ‘wp_enqueue_scripts’, ‘wp_scripts’ );

    function wp_scripts() {
    wp_register_script(‘delay’,get_template_directory_uri().”/js/delay.js”,array(‘jquery’),$version,true);
    wp_enqueue_script(‘delay’);
    }

    And this is the code for my jQuery file:

    jQuery(document).ready(function() {
    $(‘.horse-banner’).hide(0).delay(500).show(0);
    });

    The problem is every time I test it, I keep getting a “Uncaught TypeError: undefined is not a function” around line 2. I think it might have something to do with the class titled horse banner.

    <div id=”home-page” class=”wide-content”>

    <div class=”video-container banner-container”>
    <video autoplay=”” class=”horse-banner” width=”100%”>
    <source src=”../../video_1.mp4″ type=”video/mp4″>
    </video>
    </div>
    </div>

    Please help? :/

Viewing 1 replies (of 1 total)
  • Thread Starter david221

    (@david221)

    Never mind, I figured it out. I didn’t write the enqueue script properly.

    add_action(‘wp_enqueue_scripts’, ‘enqueue_assets’);

    function enqueue_assets() {
    wp_enqueue_script( ‘delay’, get_stylesheet_directory_uri(). “/js/delay.js”, array(‘jquery’), $version, true);
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Uploading jQuery files properly’ is closed to new replies.