12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- playbksound();
- // Sound Control
- function $$(name) {
- return document.getElementById(name);
- }
- function switchsound() {
- au = $$('bgsound');
- ai = $$('sound_image');
- if (au.paused) {
- au.play();
- ai.src = "images/music.png";
- pop_up_note_mode = true;
- popup_note();
- $$("music_txt").innerHTML = "ON";
- $$("music_txt").style.visibility = "visible";
- setTimeout(function () { $$("music_txt").style.visibility = "hidden" }, 2500);
- }
- else {
- pop_up_note_mode = false;
- au.pause();
- ai.src = "images/music_off.png";
- $$("music_txt").innerHTML = "OFF";
- $$("music_txt").style.visibility = "visible";
- setTimeout(function () { $$("music_txt").style.visibility = "hidden" }, 2500);
- }
- }
- function playbksound() {
- var audiocontainer = $$('audiocontainer');
- if (audiocontainer != undefined) {
- audiocontainer.innerHTML = '<audio id="bgsound" loop="loop"> <source src="images/background.mp3" /> </audio>';
- }
- var audio = $$('bgsound');
- audio.play();
- sound_div = document.createElement("div");
- sound_div.setAttribute("ID", "cardsound");
- sound_div.style.cssText = "position:absolute;right:20px;top:14px;z-index:157;visibility:visible;";
- sound_div.onclick = switchsound;
- if (document.body.offsetWidth > 400) {
- bg_htm = "<img id='sound_image' width='40px' src='images/music.png'>";
- box_htm = "<div id='note_box' style='height:100px;width:44px;position:absolute;left:5px;top:-70px'></div>";
- txt_htm = "<div id='music_txt' style='color:#cccccc;font-size:16px;font-weight:bold;position:absolute;left:-40px;top:20px;width:60px'></div>"
- }
- else {
- bg_htm = "<img id='sound_image' width='40px' src='images/music_off.png'>";
- box_htm = "<div id='note_box' style='height:100px;width:44px;position:absolute;left:-5px;top:-80px'></div>";
- txt_htm = "<div id='music_txt' style='color:#cccccc;font-size:16px;font-weight:bold;position:absolute;left:-40px;top:10px;width:60px'></div>"
- }
- sound_div.innerHTML = bg_htm + box_htm + txt_htm;
- document.body.appendChild(sound_div);
- }
- //->
|