Help with simple JQuery and getting it on the site
-
I’m a total beginner to Javascript and have spent the last few days reading about it and its relation to WordPress. I’m now attempting to insert some simple Javascript/jQuery into my site and no surprise, it’s a total failure.
First part, here is the code on jsfiddle: https://jsfiddle.net/hUxFX/
I’m just trying to get a div to animate (float up and down) when you mouseover it. I must be missing something very obvious ??Next, I’m using functions.php in my child theme to add the script to the site, but when I look at my site’s source code I don’t see the script loaded, so I don’t think it’s working. I uploaded the aforementioned script file into my child theme’s js folder. Here is the code I have in my functions.php:
<?php function ax_load_my_script() { wp_register_script( 'floating', get_template_directory_uri() . '/js/floating.js', array('jquery') ); wp_enqueue_script( 'floating' ); }; add_action( 'wp_enqueue_scripts', 'ax_load_my_script' ); ?>
I am… at a complete loss. A helping hand would be very appreciated!
edit: ah and one more thing, my site https://www.axtran.com
- The topic ‘Help with simple JQuery and getting it on the site’ is closed to new replies.