Skip to content

Commit

Permalink
adding Show/Hide Player function
Browse files Browse the repository at this point in the history
  • Loading branch information
shershen08 committed Mar 8, 2017
1 parent 46a9487 commit 5fc38f7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/gsap-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,20 @@ function gsapPlayer(params) {
'height': '15px',
'fill' : iconColor,
});

//player box hiding/showing
var playerHideTimeOut = 1000;
var isOpacityTimerRunning = false;
var setPlayerTransparent = function(){
isOpacityTimerRunning = true;
setTimeout(function(){
if(isOpacityTimerRunning) player.style.opacity = 0;
}, playerHideTimeOut);
}
var setPlayerVisible = function(){
isOpacityTimerRunning = false;
player.style.opacity = '0.8';
}

/*------------------------------------------
timeline particulars
Expand All @@ -158,6 +172,9 @@ function gsapPlayer(params) {
/*------------------------------------------
event listeners
-------------------------------------------*/

player.addEventListener('mouseleave', setPlayerTransparent);
player.addEventListener('mouseover', setPlayerVisible);

slider.addEventListener('input', function() {
this.setAttribute('value', this.value);
Expand Down

0 comments on commit 5fc38f7

Please sign in to comment.