메뉴 건너뛰기

조회 수 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>

 


List of Articles
번호 제목 날짜 조회 수
30 jQuery 요소(elements) 미디어 컨버팅 플러그인 file 2019.12.13 320
29 글 작성시 랜덤형 자동 댓글로 인사 멘트남기기 2019.12.13 323
28 iframe 금지된 사이트 iframe 으로 불러오기 2019.12.13 385
27 이미지에 워터마크 넣기 2019.12.13 389
26 style 수정시 서버에서 로딩되게 하기 2019.12.13 255
25 우측 퀵메뉴 2019.12.13 382
24 특정 게시판에서 이미지 파일만 업로드 허용하기 file 2019.12.09 367
23 쉽고 간편한 인쇄 팁 file 2019.04.29 743
22 그누보드5 검색최적화 방법입니다 file 2019.04.29 876
21 영카트5 DB 테이블별로 덤프하기 2019.04.29 864
20 게시판 기본 스킨 목록 페이지 살펴보기 1 - list.skin.php 2017.04.13 2959
19 게시판 기본 스킨 목록 페이지 살펴보기 2 - 상세 설명 2017.04.13 2321
18 게시판 기본 스킨 글쓰기 페이지 살펴보기 1 - write.skin.php 2017.04.13 2551
17 게시판 기본 스킨 글쓰기 페이지 살펴보기 2 - 상세 설명 2017.04.13 2916
16 게시판 기본 스킨 내용보기 페이지 살펴보기 2 - 상세 설명 2017.04.13 2528
15 여분필드를 활용한 게시판 스킨 제작 - 기본적인 사용 방법 2017.04.13 2892
14 여분필드를 활용한 게시판 스킨 제작 - 기초 예제1-1 file 2017.04.13 3475
13 여분필드를 활용한 게시판 스킨 제작 - 기초 예제1-2 file 2017.04.13 4262
12 여분필드를 활용한 게시판 스킨 제작 - 기초 예제1-3 file 2017.04.13 3276
11 게시판 글쓰기 페이지에 스마트 에디터 2개 이상 사용하기 2017.04.12 2778
Board Pagination Prev 1 2 3 4 Next
/ 4

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

© k2s0o1d4e0s2i1g5n. All Rights Reserved