Javascript newbie here, in need of help and hints. I'm currently calling my audio files this way:
<div class="playFeatured">
<audio id="playA" preload='none'>
<source src='audio/RM-5.1.mp3' type='audio/mpeg' />
<source src='audio/RM-5.1.ogg' type='audio/ogg' />
</audio></div>
When the checkbox (#swingBox) is checked, I want to call the audio file from the directory 'audio/swing/*') instead. Here's my current code:
var swingBox = document.getElementById('swingBox');
var straightRhythm = $('#playA').find('audio').attr("src");
$(document).ready(function() {
if $('#swingBox').prop('checked', true){
$(straightRhythm.slice(0,6) + "swing/" + straight.slice(6););};
if $('#swingBox').prop('checked', false){
$(straightRhythm);
};
}
Can anyone point me in the right direction? Thanks so much!
Aucun commentaire:
Enregistrer un commentaire