asasass
November 30, 2017, 11:19pm
464
How would you target initial
with:
hideAllButtons(button);
Something would need to be altered in this code:
function hideInitialOverlay(button) {
var button = getButtonContainer(button);
hide(button.querySelector(".initial"));
}
function initialOverlayClickHandler(evt) {
var button = getButtonContainer(evt.target);
hideInitialOverlay(button);
button.removeEventListener("click", initialOverlayClickHandler);
button.addEventListener("click", playButtonClickHandler);
playButtonClickHandler(evt);
}
What is the problem that youâre wanting to solve here?
asasass
November 30, 2017, 11:34pm
466
Using this:
hideAllButtons(button);
to hide initial
asasass
November 30, 2017, 11:36pm
467
Where would I put this?
showInitailButton(button);
Using this to hide the initial button:
function hideAllButtons(button) {
button.querySelectorAll("svg").forEach(hide);
}
Under what circumstances would that be beneficial?
1 Like
asasass
November 30, 2017, 11:40pm
469
What would be the right way to do this?
Deleting this:
function hideInitialOverlay(button) {
var button = getButtonContainer(button);
hide(button.querySelector(".initial"));
}
And adding this here worked:
hideAllButtons(button);
function initialOverlayClickHandler(evt) {
var button = getButtonContainer(evt.target);
hideAllButtons(button);
button.removeEventListener("click", initialOverlayClickHandler);
button.addEventListener("click", playButtonClickHandler);
playButtonClickHandler(evt);
}
And once again I have to ask, what are you wanting to achieve by doing that?
asasass
November 30, 2017, 11:48pm
471
What I want to do, is remove these 2 blocks of code here:
function hideInitialOverlay(button) {
var button = getButtonContainer(button);
hide(button.querySelector(".initial"));
}
function initialOverlayClickHandler(evt) {
var button = getButtonContainer(evt.target);
hideAllButtons(button);
button.removeEventListener("click", initialOverlayClickHandler);
button.addEventListener("click", playButtonClickHandler);
playButtonClickHandler(evt);
}
Which I successfully did here:
But nothing is specifically targeting initial, which I donât think is good.
or, is it targeting initial there?
asasass
November 30, 2017, 11:53pm
472
Is this the inclusion of this:
hideAllButtons(button);
targeting initial in here?
function showPauseButton(button) {
var pause = getPause(button);
hideAllButtons(button);
show(pause);
button.classList.add("active");
}
What I mean to ask you is, what is the difference of behaviour that you want from the button?
asasass
November 30, 2017, 11:58pm
474
no difference, just to hide it after itâs clicked on.
asasass
November 30, 2017, 11:59pm
475
Which mean, I donât need any of this stuff?
function hideInitialOverlay(button) {
var button = getButtonContainer(button);
hide(button.querySelector(".initial"));
}
function initialOverlayClickHandler(evt) {
var button = getButtonContainer(evt.target);
hideAllButtons(button);
button.removeEventListener("click", initialOverlayClickHandler);
button.addEventListener("click", playButtonClickHandler);
playButtonClickHandler(evt);
}
asasass
December 1, 2017, 12:00am
476
With extra code
function hideInitialOverlay(button) {
var button = getButtonContainer(button);
hide(button.querySelector(".initial"));
}
function initialOverlayClickHandler(evt) {
var button = getButtonContainer(evt.target);
hideAllButtons(button);
button.removeEventListener("click", initialOverlayClickHandler);
button.addEventListener("click", playButtonClickHandler);
playButtonClickHandler(evt);
}
Without the extra code:
The purpose of that code was to only hide the initial overlay when its clicked on, so that the play button and links would then be shown, and another click would be required to start things playing.
That was designed according to what you said you wanted before.
It will be a few hours before I can return to helping out here.
asasass
December 1, 2017, 12:02am
479
That was before I added in this:
function hideAllButtons(button) {
button.querySelectorAll("svg").forEach(hide);
}
asasass
December 1, 2017, 12:03am
480
Now that I added that in, it seems to be doing that job from within here:
But how is it doing it from in there?
function showPauseButton(button) {
var pause = getPause(button);
hideAllButtons(button);
show(pause);
button.classList.add("active");
}
If I remove:
hideAllButtons(button);
Click on the button
and the initial svg shows.
And in the html
thereâs no hide next to it:
<svg class="initial"
When this is added
hideAllButtons(button);
How exactly is it hiding initial also?
asasass
December 1, 2017, 12:29am
481
I think I figured something out.
Placed in this location hides initial after the button is clicked.
hideAllButtons(button);
function playButton(button) {
var player = button.querySelector("audio");
if (isPlaying(player)) {
showPlayButton(button);
pauseAudio(player);
} else {
hideAllButtons(button);
showPauseButton(button);
playAudio(player);
}
}
asasass
December 1, 2017, 12:39am
482
Which explains why, when
hideAllButtons(button);
is placed in here, it will also hide the initial svg button after itâs clicked.
Do I have this correct?
function showPauseButton(button) {
var pause = getPause(button);
hideAllButtons(button);
show(pause);
button.classList.add("active");
}
asasass
December 1, 2017, 12:42am
483
And so, I can get rid of this code now that I do not need it any longer. It no longer serves any purpose.
I only needed it when I wasnât using this.
function hideAllButtons(button) {
button.querySelectorAll("svg").forEach(hide);
}
I can get rid of this.
function hideInitialOverlay(button) {
var button = getButtonContainer(button);
hide(button.querySelector(".initial"));
}
function initialOverlayClickHandler(evt) {
var button = getButtonContainer(evt.target);
hideAllButtons(button);
button.removeEventListener("click", initialOverlayClickHandler);
button.addEventListener("click", playButtonClickHandler);
playButtonClickHandler(evt);
}