toggle on/off embedded music
Related Article: music toggle in jquery
is a JavaScript / DHTML / AJAX discussion thread by turpentyne that has 1 reply and was last updated 1 month ago.
turpentyne
Junior Poster in Training
84 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Care to share your solution to help others?
pritaeas
Posting Prodigy
9,267 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86
Sure! Sorry about that!
For the jquery, I put:
$(document).ready(function() {
var playing = true;
$("#music_control").click(function(){
if (playing == false) {
playing = true;
$('#music').html(" <embed src='http://url.com/dev/music/12_full_prom-night_0132.mp3' autostart='true' loop='true' width='2' height='0' id='player'> ");
$("#music_control").text("MUSIC OFF");
} else if (playing == true) {
playing = false;
$('#music').html("<!-- asdf -->");
$("#music_control").text("MUSIC ON");
}
});
});
and in the html I had a link control and the div to switch:
<a href="#" id="music_control" class="">MUSIC OFF</a>
<div id="music">
<embed src="http://url.com/dev/music/12_full_prom-night_0132.mp3"autostart="true" loop="true"
width="2" height="0" id="player">
</embed>
</div>
turpentyne
Junior Poster in Training
84 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0