Registering javascript to pan image
-
I am trying to implement a panning effect on an image, by following this tutorial. However, it’s not working. This is what I have tried so far:
The only modification I have made to the javascript for the moment is the class name, so I won’t copy it all here.
I have the javascript in: moesia-child-01/scripts/pan.js
In functions.php, I have added these functions to register the script for a theme and enqueue the script:
function my_js_scripts() { // Register the script like this for a theme: wp_register_script( 'pan-script', get_template_directory_uri() . '/scripts/pan.js' ); // For either a plugin or a theme, you can then enqueue the script: wp_enqueue_script( 'pan-script' ); } add_action( 'wp_enqueue_scripts', 'my_js_scripts' );In my theme header.php, I added this line just after <head>:
<script type="text/javascript" src="/scripts/pan.js"></script>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Registering javascript to pan image’ is closed to new replies.