Background music | SoloLearn: Learn to code for FREE!

+3

Background music

How to add autoplay music on page? https://code.sololearn.com/W3J2g8vvi3FN/?ref=app

10/19/2017 1:38:21 PM

GhostMiner

26 Answers

New Answer

+7

It is not a problem to add someone's code if you have permission to do so. The menu from the first example is a very nice classic side navigation menu with pushes the page content to the right and "hamburger" icon animations as close button. It is easy to make. But, do you have a concept (idea) what's next? Do you want active menu, or not? And so on... I think you should not change your code, but create a new one - with the same purpose but with another design. What you think about it?

+7

@SlimikCs I'm honored, but credit is not needed, it's a pleasure if I can help to you.

+7

@SlimikCs I think you have a mistake in css (style). After setting the attribute for the body, you have two braces } } instead of one }

+5

Unfortunately, autoplay is not possible on mobile browers or calling the play() function with events like onload, onmouseover, onfocus... It is only possible call the play() function with real click function. On desktop browser autoplay is work fine. It's not an optimal solution, but see if you like the correction of your code .... Note: Please let me know when I can delete this code from my box (because this is your code, not mine :) ) https://code.sololearn.com/WAp5iZ8Z7cuw/#html

+5

Do you put the loop right behind autoplay in the audio tag?

+5

<audio id="audio" src="https://padletuploads.blob.core.windows.net/prod/155875637/1fb573d4ef5dab656bf22559c16461b4/Hay_Day_Music__Halloween_.mp3" preload="auto" autoplay loop></audio>

+5

I have to go, but I'll be back in 3-4 hours

+1

audio tag autoplay

+1

+1

audio loop attribute

+1

upload to playground, so we can help u easily

+1

@LukArToDo Thanks, but can you please add the player(like before) for phone users and add loop pls? :) And can i add You to credits? OR BETTER... do you want colaborate?

+1

Why the "center" tag which is almost everywhere doesn't work? If I'm watching the code on phone half of the tables doesn't have the black backround, how to fix it?

+1

You can hide/delete the code, I copied it and add you in the credits :)

+1

I found out your script works on my Android 7 too :)

+1

Audio can play in background only after user interaction like click...Checkout this code.. https://code.sololearn.com/WOi14of2X8Rx/?ref=app

0

And how to add background music?

0

<audio controls autoplay>   <source src="your mp3 here"type="audio/mpeg">   Your browser does not support the audio element. </audio>

0

Should I put URL in here?

0

And how to set loop?