I’m trying to edit a wordpress template for a multi-video page. Each video item can be clicked to play the video, however I want that click event enabled ONLY if a link is defined (in the wordpress shortcodes). You can see an example of the video page here: http://madbunny.us/vixen/demo/all/dark/multi-video/
This is for a portfolio website, so having the image still as an item, but without a video is very important for me, if there is no link.
UPDATE:
After I tweaked it based on Jay Hewitt’s reply, it does what I want, but it introduced a new problem, it can go to the next video, but won’t go back to the previous video that doesn’t have a url (click event disabled).
jQuery('.multivideo-center-play-btn, .multivideo-preview').each(function(){
var _self = jQuery(this);
_self.bind('click',function(){
if(_self.parent().find(".hidden-url").text() != ""){
var $vid = jQuery(this).parent();
if ($vid.hasClass('active') || isAMobile)playVideo($vid);
else moveToVideo($vid);
}
});
});
What is the $content variable? It looks like it will use that one variable for all bindings.
If it’s just the URL set in the hidden-url div, then you want to add the binding to each selector meeting your criteria.
set variables in php with something like this:
The, you can check in your script the defined variable.
Otherwiese, if you don’t want to define a global variable, you can add
data
-attribute to the.multivideo-center-play-btn, .multivideo-preview
element,and check it with
jQuery( this ).data( 'enabled' )