My Code: https://jsfiddle.net/b4jw7v9g/2/
<div style="width:0;" onclick="myObject=document.getElementById('myObj');
myObject.style.display='block'; this.style.display='none'">
<div style="margin:0 0 -24px;width: 260px;height:18px;border-radius:50px;background-image: linear-gradient( to right, #000000 83px,#0059dd 83px, #0059dd 86px, #000000 86px, #000000 174px, #0059dd 174px, #0059dd 177px, #000000 177px );border: 3px solid #0059dd;"></div>
<button style="display:block; border:none;cursor: pointer;background-color:transparent;width:266px;height:24px;" onclick="document.getElementById('player').volume=1.0;player.play()"></button>
</div>
<div id="myObj" style="display: none;">
<div style="margin:0 0 -24px;width: 260px;height:18px;border-radius:50px;background-image: linear-gradient( to right, #0ff 83px,#0059dd 83px, #0059dd 86px, #fff 86px, #fff 174px, #0059dd 174px, #0059dd 177px, #f0f 177px );border: 3px solid #0059dd;"></div>
<button style="display:block; border:none;cursor: pointer;background-color:transparent;width:266px;height:24px;" onclick="document.getElementById('player').volume=1.0;player.paused ? player.play() : player.pause()"></button>
</div>
<audio id="player" preload="none">
<source src='http://hi5.1980s.fm/;' type='audio/mpeg'/></audio>
Play Mode:
http://i.imgur.com/k4yC4JB.png
I know of this method, but I have no idea how I would implement the above code into this code format. I’m a little confused on how I would do it. https://jsfiddle.net/b4jw7v9g/4/
Some help would be greatly appreciated.
margin:0 0 -24px;
width: 260px;height:18px;
border-radius:50px;
background-image: linear-gradient ( to right, #0ff 83px,#0059dd 83px, #0059dd 86px, #fff 86px, #fff 174px, #0059dd 174px, #0059dd 177px, #f0f 177px );
border: 3px solid #0059dd;
I know this is how you do a regular background image:
playButton.style.backgroundImage = 'url(\'https://i.imgur.com/qg4rg7Z.png\')';
But I’m not using an image, I’m using, linear-gradient
<button id="playButton" style="cursor: pointer; font-family:Tahoma; font-weight: bold;font-size:14px; background-color:green;color:blue;padding:13px 6px " onclick="
var button = document.getElementById('playButton');
var player = document.getElementById('player');
if (player.paused) {
playButton.innerHTML = 'Pause';
playButton.style.backgroundColor = '#cc333f';
playButton.style.padding = '13px 0px';
player.play();
} else {
playButton.innerHTML = 'Play';
playButton.style.backgroundColor = 'green';
playButton.style.padding = '13px 6px';
player.pause();
}">
Play</button>
<audio id="player" style="display:none;">
<source src='http://hi5.1980s.fm/;' type='audio/mpeg' />
</audio>
I tried this, this doesn’t seem to work unless I’m going it wrong.
playButton.style.background = 'linear-gradient ( to right, #0ff 83px,#0059dd 83px, #0059dd 86px, #fff 86px, #fff 174px, #0059dd 174px, #0059dd 177px, #f0f 177px )';