김철용

모바일 메인에 Tabs넣기

· 2023-03-31 (금) 01:32:27 · 2275 · 6

[code]

<style>
/* Style the tab */
.tab {
  overflow: hidden;
  border: 1px solid #ccc;
  background-color: #f2e6ff;
  padding-left: 10px;
  padding-right: 10px;

}

/* Style the buttons inside the tab */
.tab button {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 16px;
  transition: 0.3s;
  font-size: 17px;
    width:33.3%;
}

/* Change background color of buttons on hover */
.tab button:hover {
  background-color: #ddd;
}

/* Create an active/current tablink class */
.tab button.active {
  background-color: #ccc;
}

/* Style the tab content */
.tabcontent {
  display: none;
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-top: none;
}

/* Style the close button */
.topright {
  float: right;
  cursor: pointer;
  font-size: 28px;
}

.topright:hover {color: red;}
  
#div_kim{ padding: 15px;} 
  .h3_kim{ font-size: 15px;}
</style>

<div id="div_kim">
<h3 class="h3_kim">Here is Kims Work !!</h3>
<p>Click on the x button in the top right corner to close the current tab:</p>
</div>

<div class="tab">
  <button class="tablinks" onclick="openCity(event, 'London')" id="defaultOpen">영상제작</button>
  <button class="tablinks" onclick="openCity(event, 'Paris')">홈페이지</button>
  <button class="tablinks" onclick="openCity(event, 'Tokyo')">쇼핑몰</button>
</div>

<div id="London" class="tabcontent">
  <span onclick="this.parentElement.style.display='none'" class="topright">×</span>
  <h3 class="h3_kim">Make Video</h3>
  <p>London is the capital city of England.</p>
  <img src="../zz/images/changduk.jpg" style="width:100%;">
</div>

<div id="Paris" class="tabcontent">
  <span onclick="this.parentElement.style.display='none'" class="topright">×</span>
  <h3 class="h3_kim">Make Homepage</h3>
  <p>Paris is the capital of France.</p> <br>
  
<style>
    #mediaPlayer { position:relative; padding-bottom:56.25%; height:0px; overflow:hidden; max-width:100%; }
    .normalPlayer { position:absolute; top:0px; left:0px; width:100%; height:100%; display:block; }
</style>
<div id=mediaPlayer><iframe class=normalPlayer src=https://www.youtube.com/embed/zhhEY86_ZXA?autoplay=1 frameborder=0 allowfullscreen></iframe></div>
</div>

<div id="Tokyo" class="tabcontent">
  <span onclick="this.parentElement.style.display='none'" class="topright">×</span>
  <h3>Make Shoppingmall</h3>
    <script>
    img_1= "http://egis.kr/zz/images/square/333_1.png";
    img_2= "http://egis.kr/zz/images/square/333_2.png";
    img_3= "http://egis.kr/zz/images/square/333_3.png";
    for(imgTotal=0; this['img_'+(imgTotal+1)]; imgTotal++);
    n=1;
    function imgGo(){
      imgBtn.src= this["img_"+(n= n== imgTotal ? 1 : n+1)];
      imgOrder.innerText=n;
    }
  </script>
  <img id=imgBtn style=cursor:pointer;width:100% src=http://egis.kr/zz/images/square/333_1.png onclick=imgGo()>
  <div id=imgOrder style=text-align:center;font-size:20px>1</div>
</div>

<script>
function openCity(evt, cityName) {
  var i, tabcontent, tablinks;
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }
  document.getElementById(cityName).style.display = "block";
  evt.currentTarget.className += " active";
}

// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();
</script>
<!-- tabs end -->

[/code]

원소스는 How To Create Tabs (w3schools.com)이며 css를 약간 추가하였습니다.

mobile index.php에 넣으시면 됩니다

감사합니다.

|

댓글 6개

좋아요 감사 합니다.
@들레아빠 따뜻한 관심에 늘 감사드립니다^^
매우 유용합니다.
@오빠야 힘들 주시는 겪려의 말씀에 감사드립니다^^
감사합니다.
@써맨 관심가져주셔서 감사드립니다^^
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
PHP 24-01-19 조회 1,580
정규표현식 24-01-16 조회 2,443
JavaScript 23-12-28 조회 1,498
PHP 23-12-18 조회 4,163
PHP 23-12-17 조회 2,475
PHP 23-12-08 조회 1,459
node.js 23-12-05 조회 2,309
JavaScript 23-11-20 조회 1,991
JavaScript 23-11-20 조회 1,943
PHP
[PHP]
23-11-20 조회 3,059
JavaScript 23-11-19 조회 2,184
PHP 23-11-12 조회 1,590
JavaScript 23-11-11 조회 2,761
PHP 23-11-11 조회 1,441
jQuery 23-11-01 조회 1,520
JavaScript 23-10-31 조회 1,344
기타 23-10-05 조회 2,056
기타 23-10-01 조회 1,678
PHP 23-09-22 조회 4,414
JavaScript 23-09-16 조회 3,996
JavaScript 23-09-15 조회 3,688
JavaScript 23-09-14 조회 1,994
JavaScript
[JavaScript]
23-09-11 조회 1,467
PHP 23-09-08 조회 3,971
PHP 23-09-06 조회 2,966
JavaScript 23-09-05 조회 3,755
23-06-21 조회 2,757
23-06-01 조회 2,370
23-04-13 조회 2,061
23-04-11 조회 3,048