Your HTML currently looks like this:
<a href="#" title="{video_title} - {series_weeks:seriesWkDate format=" %m/%d/%Y "}" class="videoThumbnail video-thumbnail" rel="//player.vimeo.com/video/{series_weeks:seriesWkVidId}?title=0&byline=0&portrait=0&color=ff9933">
<img src="{video_thumbnail}" alt="{video_title} - {series_weeks:seriesWkDate format=" %m/%d/%Y "}" class="img-responsive" /><span class="playButton"></span>
</a>
However, as it seems that you're already hard coding certain parameters for each video in the a
element, so you could add data
attributes to hold the title, date, and description of the video:
<a data-title="{video_title}" data-date="{series_weeks:seriesWkDate format=" %m/%d/%Y "}" data-description="{video_description}" href="#" title="{video_title} - {series_weeks:seriesWkDate format=" %m/%d/%Y "}" class="videoThumbnail video-thumbnail" rel="//player.vimeo.com/video/{series_weeks:seriesWkVidId}?title=0&byline=0&portrait=0&color=ff9933">
<img src="{video_thumbnail}" alt="{video_title} - {series_weeks:seriesWkDate format=" %m/%d/%Y "}" class="img-responsive" /><span class="playButton"></span>
</a>
Basically, you use data-title
, data-date
, and data-description
to hold their respective data inline with the element (I wouldn't do it this way, but since you already have a lot of your data inline, why not).
If you were to take the data
path, you could then do something like this to populate the fields after clicking on a thumbnail:
$(".video-thumbnail").click(function(){
$("#video-iframe").attr("src", $(this).attr("rel"));
$("#wkTitle").text($(this).data("title"));
$("#wkDate").text("Date - " + $(this).data("date"));
$("#wkDescription").text($(this).data("description"));
});
So ultimately, this approach boils down to populating the data
fields of the thumbnail element then setting the text of the corresponding HTML elements to the inline data.
I would recommend cleaning up your HTML though, especially since as of now, your title
attribute has a syntax error because of the "
within "
. You could also not use the data
attribute and rely on the title
attribute of the thumbnail element, but then you would have to parse the string, split it at the -
, and that leaves your implementation up to various problems.
Also, this approach may not work depending on how your programmatically inserting the {}
info into the various attributes.