I've a a problem, on wordpress, on use Velocity js.
Inside function.php i've enqueued the velocity.min.js and velocity.ui.min.js, like this
wp_enqueue_script('velociti-min-js', STYLESHEET_URI . '/assets/js/velocity.min.js', array('jquery'), THEME_VERSION, true);
wp_enqueue_script('velociti-ui-min-js', STYLESHEET_URI . '/assets/js/velocity.ui.min.js', array('jquery'), THEME_VERSION, true);
Then i've enqueued the main.js file with my custom javascript code like this
wp_enqueue_script('main-theme-function', STYLESHEET_URI . '/assets/js/main-theme-function.js', NULL, THEME_VERSION, TRUE);
When i try to register a new Velocity effect, like
$.Velocity
.RegisterEffect("myeffect", {
defaultDuration: 1,
calls: [
[ { translateY: '-50%'}, 1]
]
});
I get this error on console
Uncaught TypeError: Cannot read property 'Velocity' of undefined
But I can't understand why... can someone help?
Thanks a lot
You should try using
jQuery.Velocityinstead. Alternatively you can wrap your call in an IIFE which aliases jQuery to$.