이미지 2개 토글 오디오
페이지 정보
작성자 비타주리 작성일 22-06-15 18:21 조회 2,693 댓글 0본문
<audio id=myAudio src="https://blog.kakaocdn.net/dn/c4djm7/btrET8xkkOc/89VxkXWg4wSOrnwWPKsJqK/tfile.mp3" loop></audio>
<img id=myImg style=cursor:pointer;display:block>
<script>
onImg = "https://blog.kakaocdn.net/dn/wZ0tS/btrEOGJvjIE/8dv2ALyvIwk7cGS4p1Pkd0/img.png";
offImg = "https://blog.kakaocdn.net/dn/qrTkp/btrEN9SGsPz/0ztiKLUfAkLnmJON7nwc91/img.png";
function playAudio() {
myImg.src = offImg;
myAudio.play();
}
function pauseAudio() {
myImg.src = onImg;
myAudio.pause();
}
myImg.onclick = function() {
myAudio.paused ? playAudio() : pauseAudio();
}
myImg.src = onImg;
</script>
<img id=myImg style=cursor:pointer;display:block>
<script>
onImg = "https://blog.kakaocdn.net/dn/wZ0tS/btrEOGJvjIE/8dv2ALyvIwk7cGS4p1Pkd0/img.png";
offImg = "https://blog.kakaocdn.net/dn/qrTkp/btrEN9SGsPz/0ztiKLUfAkLnmJON7nwc91/img.png";
function playAudio() {
myImg.src = offImg;
myAudio.play();
}
function pauseAudio() {
myImg.src = onImg;
myAudio.pause();
}
myImg.onclick = function() {
myAudio.paused ? playAudio() : pauseAudio();
}
myImg.src = onImg;
</script>
댓글목록 0
등록된 댓글이 없습니다.