View Full Version : How do I change CSS properties when a music player starts using JavaScript?

10-05-2012, 10:09 PM
I have a music player on my page, the code for which is this:

<!--SCM Music Player by Adrian C Shum - http://scmplayer.net-->
<script type="text/javascript" src="http://scmplayer.net/script.js" ></script>
<script type="text/javascript">
SCMMusicPlayer.init("{'skin':'skins/black/skin.css','playback':{'autostart':'true','shuffle':'true','volume':'40'},'playlist':[{'title':'2Spooky Battle','url':'http://a.tumblr.com/tumblr_mbdoptQ5LT1rte8jio1.mp3'}], 'onplay': function() {alert('playing');},'placement':'bottom','showplaylist':'false'}");
<!--End of SCM Music Player script-->

I also have two images, the codes for which look like this:

<style type="text/css">

position: fixed;
right: 10px;
bottom: 100px;
z-index: 10;

position: fixed;
left: 10px;
top: 10px;
z-index: 10;


<img src="IMAGE1.png" id="img1">
<img src="IMAGE2.png" id="img2">

I would like to work it so both of those become "visible" when the player starts. What would I need to add/take out/replace for this to work?

Logic Ali
10-06-2012, 01:28 AM
You could try:

'onplay': function() { document.getElementById( 'img1' ).style.visibility = document.getElementById( 'img2' ).style.visibility = 'visible'; },