HTML
์คํจ์ ํ์ด์ง ๋๋ฒ๋ง ๋ถ์ฌ๋ก ์ดํ ์์ค ์์
<!-- ์นํ์ ๊ณต๋ฐฑ ์ ๊ฑฐํ์ -->
<s_paging>
<div class="clear"></div>
<div class="paging">
<a [## _prev_page_ ##] class="[## _no_more_prev_ ##]" style="float: left;">
<i class="xi-angle-left-min"></i>
</a>
<s_paging_rep><a class="numbox" [## _paging_rep_link_ ##]>[## _paging_rep_link_num_ ##]</a></s_paging_rep>
<a [## _next_page_ ##] class="[## _no_more_next_ ##]" style="float: right;">
<i class="xi-angle-right-min"></i>
</a>
</div>
</s_paging>
ํ์ฌ ๊ธ์ ์ํ๋ฅผ ํ๊ธฐํ๊ธฐ ์ํด ์ดํ ํ๊ทธ ์ถ๊ฐ
<!-- <s_ad_div> ์์ ๋ฃ์ ๊ฒ, ์นํ์ ๊ณต๋ฐฑ ์ ๊ฑฐํ์ -->
<a style="color: #999">[[## _s_ad_s1_label_ ##]]</a>
CSS
ํ์ด์ง ๋๋ฒ๋ง ์คํ์ผ ๋ณ๊ฒฝ (๊ธฐ์กด ์คํ์ผ ์ผ๋ถ ์ญ์ )
/*======================================*/
/*=============== paging ===============*/
/*======================================*/
.paging{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
padding:10px 0 0;
}
.paging .numbox > .selected{
font-weight: bold;
}
์ ์ฒด ํ์ด์ง์ ํฐํธ์์ ์ ์ฉ๋์ด ๊ฒ์๊ธ ์์ ๋ณ๊ฒฝ ๋ถ๊ฐ๋ฅํ ๋ถ๋ถ ์์
/* 250503 ์ ์ฒด ์ปฌ๋ฌ ์ ์ธ (color > _color) */
* {
padding: 0;
margin: 0;
font-family: 'NanumSquareNeo', "M PLUS 1", sans-serif;
font-size: 13px;
_color: #333;
list-style: none;
word-wrap: break-word;
text-decoration: none;
box-sizing: border-box;
line-height: 20px;
}
/* 250503 ์ ์ฒด ์ปฌ๋ฌ๋ฅผ ๋ถ๋ถ ์ง์ ์ผ๋ก ๋ณ๊ฒฝ (color ์ถ๊ฐ) */
#top{
padding:0 20px 10px;
color: #333;
}
/* 250503 ์ ์ฒด ์ปฌ๋ฌ๋ฅผ ๋ถ๋ถ ์ง์ ์ผ๋ก ๋ณ๊ฒฝ (color ์ถ๊ฐ) */
#side{
float: left;
width:25%;
padding:0 20px;
color: #333;
}
/* 250503 ์ ์ฒด ์ปฌ๋ฌ๋ฅผ ๋ถ๋ถ ์ง์ ์ผ๋ก ๋ณ๊ฒฝ (color) */
.cover_wrap {
color: #333;
}
/* 250503 ์ ์ฒด ์ปฌ๋ฌ๋ฅผ article default color๋ก ์ง์ (color) */
.entry .article .ny {
color: #333;
}
ํฐ์คํ ๋ฆฌ ๊ธฐ๋ณธ ์ค์ ์ ๋ค์์นด๋ ์จ๊น์ฒ๋ฆฌ
/* ํฌ์คํ
ํ๋จ ๋ค์์นด๋ ์จ๊น ์ฒ๋ฆฌ */
[data-tistory-react-app='Namecard'] {
display: none;
}
๊ฒ์๋ฐฉ์ง
<!-- 250510 ๊ฒ์ ๋ฐฉ์ง์ฉ ํ๊ทธ -->
<meta name="robots" content="noindex, nofollow">
<meta name="Googlebot" content="noindex, nofollow">
<meta name="Naverbot" content="noindex, nofollow">
<meta name="Daumoa" content="noindex, nofollow">
250708
BGM ์ถ๊ฐ ์์ ์๋ฃ
ํน์ ๊ธ์ ์ฐธ๊ณ ๋ฐ ๊ฐ๊ณต (https://sangminem.tistory.com/211)
1) <head> ํ๊ทธ์ <audio> ํ๊ทธ ์ถ๊ฐ
<head>
...
<!-- 250708 BGM -->
<audio id='bgm' loop autoplay onloadstart="this.volume=0.5;"></audio>
</head>
2) <body> ํ๊ทธ ๋ด ํ์ํ ๊ณณ์ ๋์์ธ ๊ฐ๊ณตํ์ฌ ์ถ๊ฐ
(โป side > profile ์ sdesc๋ฅผ ๋ณต์ฌํ์ฌ ๊ฐ๊ณตํ์์ต๋๋ค.)
<div id="side">
<div class="profile">
<div class="sdesc"> ... </div>
<div class="sdesc">
<div class="">
โฌ
<span id="current-bgm">The Night in the Day</span>
</div>
<div class="">
<i class="xi-play" onclick="toggleBgm()" style="font-size:20px;vertical-align:middle;cursor:pointer;"></i>
[ <span id="current-status">playing...</span> ]
</div>
</div>
...
3) ์ตํ๋จ <script> ํ๊ทธ์ ํจ์ ์ถ๊ฐ
( ์ด๊ฒ ์์ด <audio> ํ๊ทธ๋ง ์ฌ์ฉ์ โ ๋ชจ๋ฐ์ผ ์คํ์๋จ, โก๋ฐ์คํฌํ ํน์ ์ด๋ฒคํธ ๋ฐ์ ์ ๊น์ง ์คํ์๋จ, ์ ๋๊ฐ์ง ๋ฌธ์ ๋ฐ์ )
<script>
$(window).load(function(){
...
bgmStartHandler(); // ์ถ๊ฐ
});
/* 250708 BGM */
var myBgm = $('#bgm')[0];
var bgmSource = [
{title: 'The Night in the Day',
src: 'https://blog.kakaocdn.net/dna/dcVtgz/btsO8bSyian/AAAAAAAAAAAAAAAAAAAAAJgUbC_tWoSlREq2ygmZjcOIFW2xWfC8WXMDkMBSRX-P/The%20Night%20in%20the%20Day.mp4?credential=yqXZFxpELC7KVnFOS48ylbz2pIh7yKj8&expires=1753973999&allow_ip=&allow_referer=&signature=CSVMkrGylo3ZjHppNaV5u2y4mIE%3D&attach=1&knm=tfile.mp4'}
,
];
var saveIndex = window.localStorage.getItem('current-bgm-index');
var currentIndex = saveIndex?Number(saveIndex):Math.floor(Math.random()*bgmSource.length);
var bgmStart = false;
var bgmPlaying = false;
// on/off
function toggleBgm() {
if(window.localStorage.getItem('current-bgm') == 'stop') {
window.localStorage.setItem('current-bgm', 'play');
} else {
window.localStorage.setItem('current-bgm', 'stop');
}
getCurrentBgm();
}
// ํ์ฌ ์ํ ์ธํ
function getCurrentBgm() {
$('#current-bgm').html(bgmSource[currentIndex].title);
if(window.localStorage.getItem('current-bgm') == 'stop') {
myBgm.pause();
$('#current-status').html('stop...');
$('#bgm-status-icon').addClass("xi-play");
$('#bgm-status-icon').removeClass("xi-pause");
bgmStart = false;
bgmPlaying = false;
} else {
if(!bgmPlaying){
myBgm.src = bgmSource[currentIndex].src;
//myBgm.muted = true;
var promise = myBgm.play();
if (promise !== undefined) {
promise.then(function(){
bgmStart = true;
bgmPlaying = true;
}).catch(function(error){
bgmStart = false;
bgmPlaying = false;
console.log(error);
});
}
}
$('#current-status').html('playing...');
$('#bgm-status-icon').addClass("xi-pause");
$('#bgm-status-icon').removeClass("xi-play");
}
}
function bgmStartHandler(e) {
if(!bgmStart) {
bgmStart = true;
getCurrentBgm();
}
}
$(window).on('click', bgmStartHandler);
$(window).on('touchstart', bgmStartHandler);
$(window).on('touchend', bgmStartHandler);
</script>
์๋ฅผ ์งํํด๋... ๋ธ๋ผ์ฐ์ ์ ๊ถํ์์ ๋ฒ์ด๋๋ค์..
๊ถํ์ฐจ๋จ console log ๋ด์ฉ
>> NotAllowedError: play() failed because the user didn't interact with the document first.
'Notes > Diary' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| ์์ํ๊ฒ ํฐ์คํ ๋ฆฌ ๋ณดํธ๊ธ ํ์ธ ๋ฐฉ๋ฒ ๊ธฐ๋ก (0) | 2025.06.18 |
|---|---|
| ํผํฌ๋ฏผ์ ๋ค ๋ชจ์๋ณด์ (2) | 2025.05.16 |