2 Attachment(s)
NEED SCRIPT HELP!! Sound Script Breaks Popup Layers... Complicated
Ok If any of you Xara experts can review this and see why my popups break when i add a sound button script. I will try to be as thorough as possible and this setup is complicated so please be patient with me. -- XARA 365 Premium__
Overview of intended site functionality
Site is designed to viewed on mobile devices.
1.it has a automatic popup layer as soon as the site loads
2. it has 3 buttons that operate different popup layers (Menu, Form, Social)
3. Button that plays mp3 file in background of site
#1 Automatic Popup layer uses a hidden link to name(lock) poup and website body page script
Code:
<script type="text/javascript">xr_v1(document.getElementById('mypopup1').parentNode.parentNode)</script>
#2 Blue button operate menu
- Red operate form
- White button social popup
#3 To Play Music in mobile browsers several codes are used
Body of webpage script does not break other popups are as follows
Code:
<script>
var sounds = [
"http://MySiteAt.com/audio/index_htm_files/Generic%20Audio%20File.mp3",
"http://MySiteAt.com/audio/index_htm_files/Generic%20Audio%20File.mp3"],
oldSounds = [];
var playSound = function() {
var index = Math.floor(Math.random() * (sounds.length)),
thisSound = sounds[index];
oldSounds.push(thisSound);
sounds.splice(index, 1);
if (sounds.length < 1) {
sounds = oldSounds.splice(0, oldSounds.length);
}
var $source = $('source')[0];
var $audio = $('audio')[0];
$source.src = thisSound;
$audio.load();
$audio.play();
};
</script>
Widget Box Code to insert the Play Audio Button is what breaks all the other popups
Code:
<a href="javascript:playSound()">
<img id="img_audio" src="http://textingcloud.net/images/listennow.png" width="273px" height="91px" id="ImageButton1">
</a>
<div id="element">
<audio preload="auto">
<source type="audio/mp3" />
</aud
Link to site with working popups all codes inserted except the play audio button
http://mysiteat.com/popups-work/
Link to site with play audio button added and all popups break
http://mysiteat.com/sound-works/
the files are added below if you are good at this and can help quickly I appreciate it so much i'm stuckAttachment 113624Attachment 113625
Re: NEED SCRIPT HELP!! Sound Script Breaks Popup Layers... Complicated
Hi cneal007,
The problem is in your listen now button code. You haven't closed the audio tag properly, and you haven't closed the Div tag at all. To fix this, simply open your file "sound-working-popups-broke.web", double click the listen now placeholder, click HTML Body button, and change "</aud" to be "</audio> </div>"
Thanks,
Ben
Re: NEED SCRIPT HELP!! Sound Script Breaks Popup Layers... Complicated
Ben and cneal, this post was moderated because of the script and thus invisible in the forums. I just approved it which is why if you were wondering you did not see it.