-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathscript.js
More file actions
27 lines (21 loc) · 992 Bytes
/
Copy pathscript.js
File metadata and controls
27 lines (21 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(function($){
//very quick plugin for swapping videos into a variable until you are ready for them
$.fn.videoInteraction = function(){
this.each(function(){
//varibles
var self = $(this),
$image = self.parent().find('.image-overlay'),
$video = self.find('iframe');
//remove the video until we are ready for it
$video.remove();
//bind an event to the image overlay
$image.on('click', handleVideoSwap);
//this function hides the image overlay and starts the youtube player
function handleVideoSwap(e){
$(e.target).css('display', 'none');
self.append($video);
}
});
};
$('.video-embed').videoInteraction();
}(jQuery));