JS code doesn't appear to be working

Hi, I have added a js script to my site, and I don’t think it is working correctly - it works when tested in codepen.

Am I adding them it the correct place?

I am not using cornerstone to build my pages, but have used the “Pro” / theme options link in the top of the admin.
It opens the X Theme options window, and in the narrow left side bar, I have opened the JS tab at the bottom.

This is where I placed the script.

Are you able to take a look and tell me if I have added it correctly?

What I want to happen is when the user hovers their mouse over the thumbnail, the video plays on loop until the move the mouse off the thumbnail again.

// video thumbnail play on hover
var figure = $(".video").hover( hoverVideo, hideVideo );

function hoverVideo(e) {
$(‘video’, this).get(0).play();
}

function hideVideo(e) {
$(‘video’, this).get(0).pause();
}

When you respond I can give you the logins to the site to review what I have done.
Thanks

Hi Ben,

Thank you for writing in, While that is outside the scope of support, I could point you in the right direction with the understanding that it would ultimately be your responsibility to take it from here.

Wrap your jQuery inside:

(function($){
/*script here*/
})(jQuery);

And make sure that .video is the correct class of your video container, I see .video-thumb in there (maybe I’m looking at a different video.)

Cheers!

ah, got it. Thanks. That’s exactly what I needed to know.
Codepen handles that part, hence it was missing when I copied the code out.
Thanks for the extra support there
G

You are most welcome!

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