Conditional javascript in functions.php in WordPress

I am using a jQuery plugin and adding the conditional code in functions.php breaks my home page:

function supa_theme_js() {
    wp_enqueue_script( 'fullpagejs', get_template_directory_uri() . '/js/jquery.fullPage.min.js', array('jquery'), '', false );
}
if ( is_home() ) {
    add_action('wp_enqueue_scripts', 'supa_theme_js');
}

Is it best to not include unneeded jQuery on pages that don’t need it and am I going about it the right way? My blog index/homepage is the only page that uses the plugin.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.