ํ•˜๋ฃจ๋ฅผ ํ›„ํšŒ ์—†์ด ์‚ด์•„๊ฐ€๊ธฐ ์œ„ํ•ด, ์ง€๋‚˜์˜จ ๋‚˜๋‚ ์˜ ๊ธฐ๋ก์„
๐Ÿ’œ
๊ฐ™์€ ์•…๋ชฝ์—์„œ ๊ณ„์† ํ•จ๊ป˜ โ™ฌ [ใšใ†ใฃใจใ„ใฃใ—ใ‚‡๏ผ - ใ‚ญใ‚ฟใƒ‹ใ‚ฟใƒ„ใƒค]
์Šคํ‚จ ์ˆ˜์ • ์ •๋ณด (250512)
DATE 2025/05/12
CATEGORY Notes/Diary
TAG

 

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.