Play music continuously on all pages
Follow the following steps:
1) Add the following code in the footer code. Go to SETTINGS > SEO > Footer code > paste the code
<audio preload="auto" src="http://YOURDOMAIN.weebly.com/files/theme/FILENAME.mp3" loop="true" autobuffer> </audio>
Make sure to change the link/path to your music file. (Instructions)
2) After you've done that, copy and paste the following code bellow it.
<script> function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==c_name) { return unescape(y); } } } var song = document.getElementsByTagName('audio')[0]; var played = false; var tillPlayed = getCookie('timePlayed'); function update() { if(!played){ if(tillPlayed){ song.currentTime = tillPlayed; song.play(); played = true; } else { song.play(); played = true; } } else { setCookie('timePlayed', song.currentTime); } } setInterval(update,1000); </script>
Remarks:
- There will be a small lag between pages.
- This method uses cookies. If visitors disable cookies, this won't work.
- Not all browsers support this.
> Source
Popular posts
Copyright © 2017 DDDproduktionen. All rights reserved. Powered by Weebly