From cb39cde207c391f9c6e8ec5d05baf8b9ae4b84df Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Mon, 21 Nov 2016 16:31:26 -0800 Subject: [PATCH 1/3] add jquery and javascript for click and key functions --- noise.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/noise.js b/noise.js index 1d6dd4b..dfb3eb4 100644 --- a/noise.js +++ b/noise.js @@ -1,3 +1,15 @@ -$(document).ready( function() { - // your code here +$(document).ready(function() { + $('.note').on('click', function() { + var noteSelected = $(this).html(); + alert("You played note: " + noteSelected); + var sound = $('#' + noteSelected + 'Audio')[0]; + sound.load(); + sound.play(); + }); + + $('body').keydown(function(event) { + var sound = $('#' + event.key + 'Audio')[0]; + sound.load(); + sound.play(); + }); }); From ba9827151e7b25313813931caebd343b4e54cf10 Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Mon, 21 Nov 2016 16:52:53 -0800 Subject: [PATCH 2/3] added a title --- index.html | 23 ++++++++++++----------- noise.css | 8 +++++++- noise.js | 13 ++++++++----- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/index.html b/index.html index 2023809..fd46713 100644 --- a/index.html +++ b/index.html @@ -3,50 +3,51 @@ Noises - + +

Sky's the limit(ed) Keyboard!

+ +
-
- +
+ diff --git a/noise.css b/noise.css index 5c37256..76c9b3b 100644 --- a/noise.css +++ b/noise.css @@ -3,7 +3,13 @@ html { } body { - background-color: black; + background-color: black; +} + +#sky-header { + color: white; + font-family: 'Quicksand', sans-serif; + width: auto; } .instrument { diff --git a/noise.js b/noise.js index dfb3eb4..89e4be6 100644 --- a/noise.js +++ b/noise.js @@ -1,15 +1,18 @@ +var loadPlay = function(sound) { + sound.load(); + sound.play(); +}; + $(document).ready(function() { $('.note').on('click', function() { var noteSelected = $(this).html(); - alert("You played note: " + noteSelected); + // alert("You played note: " + noteSelected); var sound = $('#' + noteSelected + 'Audio')[0]; - sound.load(); - sound.play(); + loadPlay(sound); }); $('body').keydown(function(event) { var sound = $('#' + event.key + 'Audio')[0]; - sound.load(); - sound.play(); + loadPlay(sound); }); }); From df551bc2661ceb2560e456b51dc2a81e13e338ab Mon Sep 17 00:00:00 2001 From: LaurenSky Date: Tue, 22 Nov 2016 09:08:24 -0800 Subject: [PATCH 3/3] changed header --- noise.css | 1 - 1 file changed, 1 deletion(-) diff --git a/noise.css b/noise.css index 76c9b3b..df291b0 100644 --- a/noise.css +++ b/noise.css @@ -9,7 +9,6 @@ body { #sky-header { color: white; font-family: 'Quicksand', sans-serif; - width: auto; } .instrument {