/
scripts.js
45 lines (37 loc) · 1.08 KB
/
scripts.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
jQuery(document).ready(function($) {
$('.youtube-video').mediaelementplayer();
$('.youtube-video').on('mouseenter', function(){
var mute = $(this).hasClass('muted');
$(this).find("button").each( function( i, el) {
var elem = $( el );
if(elem.attr("title") == 'Play'){
elem.click();
}
console.log(mute);
if(mute){
if(elem.attr("title") == 'Mute'){
elem.click();
}
}
})
}).on('mouseleave', function(){
$(this).find("button").each( function( i, el ) {
var elem = $( el );
if(elem.attr("title") == 'Pause'){
elem.click();
}
})
});
$('.html-video').each(function(i, obj) {
$(this).on("mouseover", function() {
if($(this).hasClass('muted')){
this.muted = true;
}
this.play();
});
$(this).on("mouseout", function() {
this.muted = false;
this.pause();
});
});
});