2016-08-21 5 views
-1

이 웹 사이트에서 볼 수 있습니다. http://www.templategarden.com/preview/tempo/template/index.html 포트폴리오 섹션에서 버튼을 클릭하면 다른 div가 나타납니다. 기본 컨테이너의 크기도 이에 따라 증가하거나 감소합니다. JS/Jquery가 필요할 것 같습니다. 웹 개발에 익숙하지 않은 사람들을 도와주세요.버튼을 클릭하면 div를 봅니다

.wrap { 
 
     max-width: 1150px; 
 
     margin-left: auto; 
 
     margin-right: auto; 
 
    } 
 
    
 
    #portone { 
 
     text-align: center; 
 
     margin-top: 80px; 
 
    } 
 
    
 
    .porttwo { 
 
     font-size: 34px; 
 
     color: #222222; 
 
     font-family: 'Montserrat', sans-serif; 
 
     font-weight: 700; 
 
     letter-spacing: -1px; 
 
     text-transform: uppercase; 
 
    } 
 
    
 
    #portthree { 
 
     font-size: 16px; 
 
     color: #888888; 
 
     font-family: 'Open Sans', sans-serif; 
 
     font-weight: 400; 
 
     line-height: 2.1; 
 
    } 
 
    
 
    
 
    /*buttons starts here*/ 
 
    
 
    #select { 
 
     width: 660px; 
 
     height: 45px; 
 
     margin-left: auto; 
 
     margin-right: auto; 
 
     margin-top: 40px; 
 
    } 
 
    
 
    .buttonz { 
 
     margin-left: 9px; 
 
     padding: 10px 22px; 
 
     font-size: 12px; 
 
     font-weight: normal; 
 
     line-height: 20px; 
 
     color: #222222; 
 
     border-radius: 4px; 
 
     text-transform: uppercase; 
 
     font-family: 'Montserrat', sans-serif; 
 
     background-color: #f7f7f7; 
 
     border: 1px solid #f7f7f7; 
 
     cursor: pointer; 
 
    } 
 
    
 
    .buttonz:hover { 
 
     background-color: #7cc576; 
 
     border-color: #7cc576; 
 
     color: #fff; 
 
     transition: ease 0.5s; 
 
    } 
 
    
 
    
 
    /*buttons end here*/ 
 
    
 
    #portfolio_img { 
 
     margin-top: 50px; 
 
    } 
 
    
 
    .project { 
 
     margin-left: 16px; 
 
     margin-bottom: 90px; 
 
    }
  <section class="wrap"> 
 
      <div id="portone"> 
 
       <h1 class="porttwo" id="portfolio">portfolio</h1> 
 
       <h3 id="portthree">Fresh portfolio designs that will keep you wanting you more.</h3> </div> 
 
      <!--buttons starts here--> 
 
      <div id="select"> 
 
       <input class="buttonz" name="button" type="button" value="ALL"> 
 
       <input class="buttonz" name="button" type="button" value="BRANDING"> 
 
       <input class="buttonz" name="button" type="button" value="WEB DESIGN"> 
 
       <input class="buttonz" name="button" type="button" value="PRINT DESIGN"> 
 
       <input class="buttonz" name="button" type="button" value="PHOTOGRAPHY"> </div> 
 
      <!--buttons end here--> 
 
      <!--portfolio images starts here--> 
 
      <div id="portfolio_img"> 
 
       <a href="#"><img class="project" src="http://planusdesign.com/images/Portfolio-pic1.jpg" alt="project-img"></a> 
 
       <a href="#"><img class="project" src="http://planusdesign.com/images/Portfolio-pic2.jpg" alt="project-img"></a> 
 
       <a href="#"><img class="project" src="http://planusdesign.com/images/Portfolio-pic3.jpg" alt="project-img"></a> 
 
       <a href="#"><img class="project" src="http://planusdesign.com/images/Portfolio-pic4.jpg" alt="project-img"></a> 
 
       <a href="#"><img class="project" src="http://planusdesign.com/images/Portfolio-pic5.jpg" alt="project-img"></a> 
 
       <a href="#"><img class="project" src="http://planusdesign.com/images/Portfolio-pic6.jpg" alt="project-img"></a> 
 
      </div> 
 
      <!--portfolio images ends here --> 
 
     </section>

+0

* "나는 JS/JQuery와이 필요합니다 같아요"* - ** YES, IT WILL * * ... 네가 어디 있니? 최소한이 코드를 직접 작성하려고 할 것으로 예상됩니다. 스택 오버플로는 코드 작성 서비스가 아닙니다. 나는 당신이 [** 추가 연구 **] (http://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) Google을 통해 또는 SO를 검색하여 시도하고 시도하십시오. 문제가 계속되면 ** 코드 **로 돌아와서 시도한 내용과 작동하지 않은 이유를 설명하십시오. –

답변

0

는 JS/JQ 불필요. 이것을 확인하십시오. U 목록에 속하는 속성 all,web, app, brand을 변경할 수 있습니다

<div class="item" all brand web>1</div> 

.item { 
 
    display: inline-block; 
 
    width: 100px; 
 
    height: 100px; 
 
    margin: 0 16px 16px 0; 
 
    line-height: 100px; 
 
    text-align: center; 
 
    color: #08f; 
 
    font-size: 100px; 
 
    background-color: lightblue; 
 
} 
 
.item, 
 
input[type="radio"] { 
 
    display: none; 
 
} 
 

 
label { 
 
    display: inline-block; 
 
    border: 1px solid #000; 
 
    padding: 1em; 
 
    margin-bottom: 16px; 
 
} 
 
label:hover { 
 
    background-color: blue; 
 
    color: #fff; 
 
} 
 

 
#rball:checked ~ .item[all] { 
 
    display: inline-block; 
 
} 
 
#rbweb:checked ~ .item[web] { 
 
    display: inline-block; 
 
} 
 
#rbapp:checked ~ .item[app] { 
 
    display: inline-block; 
 
} 
 
#rbbrand:checked ~ .item[brand] { 
 
    display: inline-block; 
 
} 
 
hr { 
 
    border: transparent; 
 
    padding: 0; 
 
    margin: 0; 
 
    }
<input name="rb" type="radio" id="rball" checked><label for="rball">All</label> 
 
<input name="rb" type="radio" id="rbweb"><label for="rbweb">Web Design</label> 
 
<input name="rb" type="radio" id="rbapp"><label for="rbapp">App Development</label> 
 
<input name="rb" type="radio" id="rbbrand"><label for="rbbrand">Branding</label> 
 
<hr> 
 
<div class="item" all brand web>1</div> 
 
<div class="item" all app>2</div> 
 
<div class="item" all brand>3</div> 
 
<div class="item" all web>4</div> 
 
<div class="item" all app web>5</div> 
 
<div class="item" all web>6</div> 
 
<div class="item" all app>7</div> 
 
<div class="item" all web>8</div>

관련 문제