Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume Bar disappears when mouse goes on it #78

Open
jacopocarlini opened this issue Jan 5, 2017 · 4 comments
Open

Volume Bar disappears when mouse goes on it #78

jacopocarlini opened this issue Jan 5, 2017 · 4 comments

Comments

@jacopocarlini
Copy link

When the mouse goes on the volume icon, the bar appears, but I can't use the bar because when the mouse moves from the volume icon to the volume bar, the volume-bar disappears immediately.

@zgangjin
Copy link

zgangjin commented Jun 2, 2017

Yes, can this problem be repaired? Thank you

@crazybugliu
Copy link

this problem still exists in version 6.0.1, can it be fixed ?

@ondrejpaluch
Copy link

I fixed the problem using following code

var wjs = require("wcjs-player");

var player = new wjs("#player").addPlayer({
  autoplay: true,
  wcjs: require('wcjs-prebuilt')
});

// find volume button and control
var volButton  = player.find('.wcp-vol-button');
var volControl = player.find('.wcp-vol-control');

// remove wrong listeners
volButton.off('mouseleave');
volControl.off('mouseout');

// watch cursor position
var isOverButton = false;
volButton.on('mouseenter', function () { isOverButton = true; });
volButton.on('mouseleave', function  () { isOverButton = false; });

var isOverControll = false;
volControl.on('mouseenter', function () { isOverControll = true; });
volControl.on('mouseleave', function () { isOverControll = false; });

var hideVolControlIfNeeded = function () {
    setTimeout(function () {
        if ( !(isOverButton || isOverControll) ) {
            volControl.animate({ width: 0 }, 200);
        }
    }, 300);
};

// hide volume control on mouseleave if mouse not over volume button or volume control
volButton.on('mouseleave', hideVolControlIfNeeded);
volControl.on('mouseleave', hideVolControlIfNeeded);

@jaruba
Copy link
Owner

jaruba commented Oct 28, 2017

@ondrejpaluch please Fork the project and send a PR, I would gladly accept it and credit you accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants