메뉴 건너뛰기

조회 수 0 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

원래는 첨부파일로 mp3 를 ff0000.mp3 으로 올리면 파일이름의 색상코드대로 하단 빨간색 부분에 색상코드가 들어가게끔 스킨을 만들어서 배포하려고 했는데 심히 귀찮아서 자바스크립트 코드만 올립니다.

반응형입니다.^^

<link href="https://fonts.googleapis.com/css2?family=Lato" rel="stylesheet">
<style>
#playerDiv { position:fixed; left:0px; bottom:0px; height:50px; padding:0px 25px; display:flex; justify-content:space-between; align-items:center; gap:15px; box-sizing:border-box; border-top:1px solid #cccccc; background:linear-gradient(#fefefe 50%, #cccccc 50%); }
#playerDiv .player-button { color:#900000; font-size:16px; font-family:Lato; font-weight:bold; cursor:pointer; }
#playerDiv .player-timer { color:#000000; font-size:16px; font-family:Lato; font-weight:bold; }
#playerBar { display:block; height:12px; cursor:pointer; appearance:none; }
#playerBar::-webkit-progress-value { background-color:#900000; border-radius:6px; }
#playerBar::-webkit-progress-bar { background-color:#eeeeee; border-radius:6px; border:1px solid #cccccc; }
</style>
<div id="playerDiv">
    <span class="player-button" onclick="mediaPlayer.play()">PLAY</span>
    <span class="player-timer">00:00</span>
    <progress id="playerBar"></progress>
    <span class="player-timer">00:00</span>
    <span class="player-button" onclick="mediaPlayer.pause()">STOP</span>
    <audio id="mediaPlayer" src="https://blog.kakaocdn.net/dn/nWkUM/btsFmizmJPO/DDQPHIqL68Ow2rPJlXvqIK/tfile.mp3" autoplay loop></audio>
</div>
<script>
setInterval(() => {
    if (mediaPlayer.duration > 0) {
        playerBar.max = Math.floor(mediaPlayer.duration);
        playerBar.value = Math.floor(mediaPlayer.currentTime);
        document.querySelectorAll(".player-timer")[0].innerText = ("0" + Math.floor(mediaPlayer.currentTime / 60)).slice(-2) + ":" + ("0" + Math.floor(mediaPlayer.currentTime % 60)).slice(-2);
        document.querySelectorAll(".player-timer")[1].innerText = ("0" + Math.floor(mediaPlayer.duration / 60)).slice(-2) + ":" + ("0" + Math.floor(mediaPlayer.duration % 60)).slice(-2);
    }
}, 500);
playerBar.onmousedown = (event) => {
    mediaPlayer.currentTime = event.offsetX * playerBar.max / playerBar.offsetWidth;
    mediaPlayer.play();
}
addEventListener("resize", playerSize = function() {
    playerDiv.style.width = document.documentElement.clientWidth + "px";
    playerBar.style.width = playerDiv.offsetWidth - 284 + "px";
});
playerSize();
</script>

 


  1. 회원가입 약관동의 전체동의 보완

    Date2024.04.09 Views0
    Read More
  2. 회원가입 못하게

    Date2023.01.05 Views79
    Read More
  3. 회원 목록을 select 로 불러와서 선택시 input 에 집어넣기

    Date2019.12.13 Views588
    Read More
  4. 회원 등급(권한)에 따라서 다른 메시지 보이기

    Date2021.03.24 Views146
    Read More
  5. 회원 가입 페이지에서 랜덤 닉네임 보여주기

    Date2024.04.09 Views0
    Read More
  6. 홈페이지를 특정 IP 일때 다른 페이지로 연결하기

    Date2024.04.09 Views0
    Read More
  7. 하나의 게시판에 여러 스킨을 적용해 보자

    Date2024.04.09 Views0
    Read More
  8. 페이지 하단 커스텀 플레이어

    Date2024.04.09 Views0
    Read More
  9. 특정국가 차단하기

    Date2024.04.09 Views1
    Read More
  10. 특정 게시판에서 이미지 파일만 업로드 허용하기

    Date2019.12.09 Views367
    Read More
  11. 카운트다운 스크립트

    Date2019.12.13 Views317
    Read More
  12. 접속주소가 https로 되여 있는지 판단하여 $g5_path['url']를 수정하기

    Date2024.04.09 Views8
    Read More
  13. 이미지에 워터마크 넣기

    Date2019.12.13 Views389
    Read More
  14. 이름이나 연락처 중간 부분을 *** 표시로 숨기기

    Date2017.04.12 Views3063
    Read More
  15. 이름 마지막 한자리 별표 처리

    Date2019.12.13 Views326
    Read More
  16. 유튜브 반응형 만들기

    Date2024.04.09 Views0
    Read More
  17. 유튜브 동영상 시간체크 후 폼 전송하기

    Date2024.04.09 Views0
    Read More
  18. 웹상에서 PDF 뷰어 소스 (copyright 2021 Mozilla)

    Date2024.04.09 Views1
    Read More
  19. 우측 퀵메뉴

    Date2019.12.13 Views382
    Read More
  20. 외부 유입 검색어 나리야 사용가능 [뿡쁑님 자료]

    Date2024.04.09 Views0
    Read More
Board Pagination Prev 1 2 3 4 Next
/ 4

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved