[ κ΅¬κΈ λ°°λκ΄κ³ μ½λ ] μ¬μ΄λ κ³ μ κ΅¬κΈ κ΄κ³ λ°°λ μ μ λ°©λ²
λ°νμΌ: 2024. 12. 1.
κ΅¬κΈ κ΄κ³ μ½λ νμ©ν μ¬μ΄λ λ°°λ μ μ
κ΅¬κΈ κ΄κ³ μ½λλ₯Ό νμ©ν΄μ μ¬μ΄λ λ°°λ κ΄κ³ μ μ λ°©λ²μ λλ€. λͺ¨λ°μΌ μνκ° λλ©΄ λ°°λμ½λ μ체λ₯Ό μ€νμ΄ μ λκ² μμ νμ΅λλ€. μΌλ°μ μΌλ‘ μ¬μ© μ κ΅³μ΄ λͺ¨λ°μΌμμ 보μ΄μ§ μλ μ¬μ΄λ λ°°λ κ΄κ³ λ₯Ό μμ κΉμ§ ν νμλ μμ§λ§ λ©λͺ¨λ¦¬λ₯Ό μλͺ¨νκΈ°λ νκ³ λ ν° λ¬Έμ λ μ½μμ μλ¬ λ©μμ§λ₯Ό νμνκΈ° λλ¬Έμ κ²μλ΄μ μ€λ₯λ₯Ό μΈμν΄μ μ±λ₯ κ²μ¬ μ μλ₯Ό νλ½μν΅λλ€.
κ΄κ³ λ² λ μ½λ
μ¬μ΄λ λ°°λ CSS μ½λ μ€λͺ
μλ μ¬μ΄λ λ°°λ μ½λλ₯Ό μμ μ κ΄κ³ μ½λμ λ§κ² μμ ν΄μ μ¬μ©νμλ©΄ λ©λλ€. μ¬μ΄λ λ°°λ κ΄κ³ μ μμΉλ λ³κ²½ν΄μ μ¬μ©νμκ³ νμ΄μ§μ ν΄μλμ ν¬κΈ°λ₯Ό κ³μ°ν΄μ μ€μ νμλ©΄ μ¬μ΄λ λ°°λ κ΄κ³ μ μμΉλ₯Ό μ€μ ν μ μμ΅λλ€. μ΅λνμ λ ΈμΆκ³Ό μ¬μ©μμ λΆνΈν¨μ μ΅λνμΌλ‘ μ€μ΄λλ‘ κ΄κ³ μ μμΉλ₯Ό μ€μ νμλ©΄ λ©λλ€.
μ€λ₯Έμͺ½ κ³ μ μ¬μ΄λ λ°°λ
position: absolute; /* μμλ₯Ό μ λ μμΉμ λ°°μΉ */
width: 160px; /* μμμ λλΉ μ€μ */
right: 50%; /* μμλ₯Ό μ€λ₯Έμͺ½μμ 50% λ¨μ΄μ§ μμΉμ λ°°μΉ */
top: 60px; /* μμλ₯Ό μμμ 60px λ¨μ΄μ§ μμΉμ λ°°μΉ */
margin-right: 470px; /* μμμ μ€λ₯Έμͺ½ μ¬λ°± μ€μ */ μ΄λΆλΆμ μμ νμλ©΄ μμΉ λ³κ²½
z-index: 9999; /* μμμ z-index μ€μ , λ€λ₯Έ μμ μμ νμλλλ‘ ν¨ */
transform: translateX(-50%); /* μμλ₯Ό μν μ€μμΌλ‘ μ΄λ */
μΌμͺ½ μ¬μ΄λ κ³ μ λ°°λ
position: absolute; /* μμλ₯Ό μ λ μμΉμ λ°°μΉ */
width: 160px; /* μμμ λλΉ μ€μ */
left: 50%; /* μμλ₯Ό μΌμͺ½μμ 50% λ¨μ΄μ§ μμΉμ λ°°μΉ */
margin-left: 650px; /* μμμ μΌμͺ½ μ¬λ°± μ€μ */ μ΄λΆλΆμ μμ νμλ©΄ μμΉ λ³κ²½
top: 60px; /* μμλ₯Ό μμμ 60px λ¨μ΄μ§ μμΉμ λ°°μΉ */
z-index: 9999; /* μμμ z-index μ€μ , λ€λ₯Έ μμ μμ νμλλλ‘ ν¨ */
transform: translateX(-50%); /* μμλ₯Ό μν μ€μμΌλ‘ μ΄λ */
μΉ΄μΉ΄μ€ μ λν κ΄κ³ μ€μ
var adArea = document.createElement('ins');
adArea.className = 'kakao_ad_area'; adArea.style.display = 'block'; // κ΄κ³ μμμ 보μ΄λλ‘ μ€μ
adArea.setAttribute('data-ad-unit', 'κ΄κ³ μ½λ'); // κ΄κ³ λ¨μ μ€μ
adArea.setAttribute('data-ad-width', '160'); // κ΄κ³ λλΉ μ€μ
adArea.setAttribute('data-ad-height', '600'); // κ΄κ³ λμ΄ μ€μ
floatLeftElement.appendChild(adArea);
μ¬μ΄λλ°μ λμ μ΄λκ³Ό κ³ μ μ€μ μΌλ‘ λΈλ‘κ·Έ μμ΅ ν₯μ λ°©μ
μ¬μ΄λλ°μ λΈλ‘κ·Έ μμ΅λΈλ‘κ·Έμμ μ¬μ΄λλ°λ μ 보μ κ΄κ³ λ₯Ό μ¬μ©μμκ² λ ΈμΆνλ©° [ λΈλ‘κ·Έ μμ΅ ]μ μν₯μ μ£Όλ μμμ λλ€. κ·Έλ¬λ μΌλΆ μ€ν¨μ λͺ¨λ°μΌμμλ μ¬μ΄λλ°κ° μ νμ μμλ‘ μ
everydayhub.tistory.com
κ΅¬κΈ μ λμΌμ€ κ΄κ³ μ½λ μ€μ
var adArea = document.createElement('ins');
adArea.className = 'adsbygoogle'; adArea.style.display = 'block'; // κ΄κ³ μμμ 보μ΄λλ‘ μ€μ
adArea.setAttribute('data-ad-client', 'ca-pub-κ΄κ³ ν΄λΌμ΄μΈνΈ μ½λ'); // κ΄κ³ ν΄λΌμ΄μΈνΈ μ€μ
adArea.setAttribute('data-ad-slot', 'κ΄κ³ μ¬λ‘― μ½λ'); // κ΄κ³ μ¬λ‘― μ€μ
adArea.setAttribute('data-ad-format', 'auto'); // κ΄κ³ ν¬λ§· μ€μ
adArea.setAttribute('data-full-width-responsive', 'true'); // κ΄κ³ μ κ°λ‘ν λ°μν μ€μ
floatRightElement.appendChild(adArea);
μ€ν¬λ¦½νΈ μ½λ
<style> #floatLeft { position: absolute; width: 160px; right: 50%; top: 60px; margin-right: 470px; z-index: 9999; transform: translateX(-50%); } #floatRight { position: absolute; width: 160px; left: 50%; margin-left: 650px; top: 60px; z-index: 9999; transform: translateX(-50%); } @media (max-width: 1300px) { #floatLeft, #floatRight { display: none; } } </style> <div class="height"> <div id="floatLeft"> <script> if (window.innerWidth > 768) { var floatLeftElement = document.querySelector('#floatLeft'); if (floatLeftElement) { var adArea = document.createElement('ins'); adArea.className = 'kakao_ad_area'; adArea.style.display = 'block'; adArea.setAttribute('data-ad-unit', 'κ΄κ³ μ½λ'); adArea.setAttribute('data-ad-width', '160'); adArea.setAttribute('data-ad-height', '600'); floatLeftElement.appendChild(adArea); var script = document.createElement('script'); script.src = "//t1.daumcdn.net/kas/static/ba.min.js"; script.async = true; document.body.appendChild(script); } } </script> </div> </div> <div class="height"> <div id="floatRight"> <script> if (window.innerWidth > 768) { var floatRightElement = document.querySelector('#floatRight'); if (floatRightElement) { var adArea = document.createElement('ins'); adArea.className = 'adsbygoogle'; adArea.style.display = 'block'; adArea.setAttribute('data-ad-client', 'ca-pub-κ΄κ³ μ½λ'); adArea.setAttribute('data-ad-slot', 'κ΄κ³ μ½λ'); adArea.setAttribute('data-ad-format', 'auto'); adArea.setAttribute('data-full-width-responsive', 'true'); floatRightElement.appendChild(adArea); var script = document.createElement('script'); script.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-μ½λ"; script.async = true; script.crossOrigin = "anonymous"; document.body.appendChild(script); (adsbygoogle = window.adsbygoogle || []).push({}); } } </script> </div> </div> <script> $(document).ready(function() { if (window.innerWidth > 1300) { var floatPositionLeft = parseInt($("#floatLeft").css('top')); var floatPositionRight = parseInt($("#floatRight").css('top')); $(window).scroll(function() { var scrollTop = $(window).scrollTop(); var newPositionLeft = scrollTop + floatPositionLeft + "px"; var newPositionRight = scrollTop + floatPositionRight + "px"; $("#floatLeft").stop().animate({ "top": newPositionLeft }, 500); $("#floatRight").stop().animate({ "top": newPositionRight }, 500); }).scroll(); } else { $("#floatLeft").hide(); $("#floatRight").hide(); } }); </script>
ν°μ€ν 리 HTML λ² λμΆλ ₯νμ© λ°©λ²
ν°μ€ν 리 HTML λ°°λμΆλ ₯μ μμ μ½λλ₯Ό μμ ν΄μ λ£μ΄μ£Όμλ©΄ λ©λλ€.
κ΅¬κΈ μλ κ΄κ³ μ½λ μ€μ λ°©λ²
ꡬκΈμ λμΌμ€μ μ μν΄μ κ΄κ³ λμ λ€μ΄κ°μλ©΄ κ΄κ³ λ¨μ κΈ°μ€ λ©λ΄κ° μμ΅λλ€.
λμ€νλ μ΄ κ΄κ³ μ€μ
κ΅¬κΈ μ λμΌμ€ μ½λ μμ±κΈ° νμ©
μ λμ€νλ μ΄ κ΄κ³ μμ μμ§ν κ΄κ³ λ¨μ μ΄λ¦ μ€μ κ΄κ³ ν¬κΈ°λ λ°μν λ§λ€κΈ° λ²νΌμ λλ¦ λλ€.
λ¨ ν°μ€ν 리 λΈλ‘κ·Έμμ λ μΌκ΄κ³ λ μ μ± μλ°μ΄λΌ μ¬μ©νμλ©΄ μλ©λλ€.