Beverley:
Thank you so much. The demo you posted is exactly what I'm looking for.
However, I tried reproducing it and although the overlay does display, I
can't get the song title to display. Below is the full code if you could see
what I'm doing wrong:
Website
"The penny just dropped..." That is very funny. I've never heard it before.
I'll play around with the path again after completing this title overlay.
Thank you for that.
CSS
Code:
#info-box { width:800px; height:326px; float:right; display:none; color:#fff; text-align:center; vertical-align:middle; font:22px/1.85em Arial, Verdana, Helvetica, sans-serif; position:relative; top:20%; right:10%; color:white; z-index:55;}
SCRIPT
Code:
<!-- START | SONG PREVIEW ONLY ON FIRST VISIT -->
<div style="background-image:url(/imgs/guitar-background.png); position:center center; repeat: no repeat;" id="info-box"><p style="margin-top:100px; margin-right:400px;">A Preview Of<br>' <b><?php echo $ftext; ?></b> '<br>from <b><span style="color:red;">Billy Joe's</span> Debut CD</b></p></div>
<?php
if($revisit){
?>
<?
} else {
?>
<?php
$files = glob('bgAudio/*.mp3'); // get all .mp3 files in the music directory
$fname = $files[array_rand($files)]; // get a random filename
echo $fname;
$ftext = ucwords(str_replace('_', ' ', basename($fname, '.mp3'))); // get song title from $fname for display
echo $ftext;
?>
<audio autoplay="autoplay" id="bgAudio">
<source src="<?php echo $fname; ?>"/>
</audio>
<script>
jQuery(function($) {
$("#bgAudio").prop('volume', .7);
window.setVolume = function(bgAudio, vol) {
sounds[bgAudio].volume = .7;
}
$('#bgAudio').on('playing', function() {
$("#info-box").fadeIn();
});
$('#bgAudio').on('ended', function() {
$("#info-box").fadeOut();
});
});
</script>
<?php
}
?>
<!-- END | SONG PREVIEW ONLY ON FIRST VISIT -->
Also, for some reason, in Firefox the title display doesn't work in the demo as well as on the website.
Thank you so much Beverley.
PS - On your demo page there is just one path to one song . There are no additional selections listed,
and yet, on new page loads a different song plays? How is that possible?
EDIT: When you resize the window as in the attached screenshot, the song title and path display at the left upper corner.
Bookmarks