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

Feature Added: Toggle Audio #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

KarthikS373
Copy link
Contributor

Issue #2 Add a toggle for music

New Feature: Introduced a audio toggling button which can be used to toggle game audio

Screenshot:
brick-breaker-toggleAudio

Changes
Added a playAudio flag to control in game audio and toggled the flag using the control button

+ const toggleAudio = document.querySelector('.toggle-audio');
+    console.log(toggleAudio)
+   toggleAudio.addEventListener('click', (e) => {
+    if(toggleAudio.classList.contains('active')){
+       x.pause();
+        playAudio = false;
+    } else {
+        playAudio = true;
+    }
+    toggleAudio.classList.toggle('active');
+    })

@@ -239,7 +165,104 @@ <h1 class="game-text">Game</h1>
Score: <span id="score">10000</span>
</div>
</div>
<div class="toggle-audio-container">
<div class="toggle-audio active">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Button is not visible

index.html Outdated
// }
// btn3.onclick = function () {
// modal3.style.display = "flex";
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

index.html Outdated
}

const toggleAudio = document.querySelector('.toggle-audio');
console.log(toggleAudio)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove console.log

@tanmayVaish tanmayVaish closed this Oct 4, 2022
@grawish grawish reopened this Oct 4, 2022
@grawish grawish added enhancement New feature or request good first issue Good for newcomers hacktoberfest labels Oct 4, 2022
@grawish
Copy link
Member

grawish commented Oct 10, 2022

@KarthikS373 any updates?

@KarthikS373
Copy link
Contributor Author

@grawish Made the necessary changes - removed commented codes, console logs and also fixed visibility of toggle button. please review

@KarthikS373
Copy link
Contributor Author

@grawish Any updates on this?

@grawish
Copy link
Member

grawish commented Oct 14, 2022

@KarthikS373 kindly resolve conflicts

@KarthikS373
Copy link
Contributor Author

@KarthikS373 kindly resolve conflicts

Resolved the conflicts

@KarthikS373
Copy link
Contributor Author

@grawish Any updates over this?...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants