Skip to content

Instantly share code, notes, and snippets.

@creyn

creyn/index.html Secret

Created August 11, 2018 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creyn/deee7f852a04790958c12828795102a0 to your computer and use it in GitHub Desktop.
Save creyn/deee7f852a04790958c12828795102a0 to your computer and use it in GitHub Desktop.
Droga Programisty : Szybkie Palce : deaktywacja przycisku
<!-- dzieki zastosowaniu obrazka, filtrow i pseudoklasy hover z jednego obrazka mozemy zrobic ladny przycisk -->
<img id="przyciskStart" class="active" src="obrazki/start.png" onclick="RozpocznijGre()">
// Funkcja wylaczajaca przycisk START
function WylaczPrzyciskStart() {
document.getElementById('przyciskStart').classList.remove('active');
document.getElementById('przyciskStart').classList.add('inactive');
...
}
// Funkcja sluzy do rozpoczynania nowej gry
function RozpocznijGre() {
// sprawdzamy czy przycisk jest aktywny, jezeli nie to wychodzimy
if(!document.getElementById('przyciskStart').classList.contains('active')) {
return;
}
WylaczPrzyciskStart();
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment