HTML5 Video If hash is equal to value set the audio to 1 else set the audio to 0 using Javascript Functions
<p>Hello I am trying to set the HTML5's video audio level depending on the location hash for example if the hash is #home the video's audio should be 1.0 if the hash isn't #home then the audio level should be 0.0
I've had a play around and i can't seem to get it to work here is my code 
and thank you for taking a look and for any help! </p>

<pre><code> $(function() {
   if (location.hash === "#home") {
     videoAudio();
   }
 } else {
   videoAudioMute();
 });

 function videoAudio() {
   var vid = document.getElementById("myvideo");
   vid.volume = 1.0;
 }

 function videoAudioMute() {
   var vid = document.getElementById("myvideo");
   vid.volume = 0.0;
 }
</code></pre>

<p>html</p>

<pre><code>&lt;div class="background"&gt;
      &lt;video id="myvideo" poster="assets/img/slide1-background-img-pattern-01.jpg" controls="" autoplay="" loop=""  &gt;
      &lt;source src="assets/vid/Background.mp4" type="video/mp4"&gt;
      &lt;source src="assets/vid/Background.webm" type="video/webm"&gt;
      &lt;source src="assets/vid/Background.ogv" type="video/ogg"&gt;
    &lt;/video&gt;
  &lt;/div&gt;
</code></pre>