묻고답하기

html attr을 이용해 이미지를 클릭하면 거기에 해당하는 이미지로 변경하게 js를 만들었는데요 변경된 이미지를 또 한번 클릭했을시 colorbox popup으로 뜨게 하려고 하는데 가능한가요? 어떤식으로 js를 짜야 하는지 막막하여 이렇게 글 올립니다. 고수님들 부탁드려요

html

<section>
    <div class="section_wrap">
        <div class="section_wrap_rel">
            <h1>portpoflio</h1>
            <div class="box1">
                <ul>
                    <li>
                        <div>
                            <img src="img/1.jpg" alt="">

                            </div>
                    </li>
                    <li>
                        <div>
                            <img src="img/2.jpg" alt="">
                        </div>
                    </li>

                    <li>
                        <div>
                            <img src="img/3.jpg" alt="">
                        </div>
                    </li>

                    <li>
                        <div>
                            <img src="img/4.jpg" alt="">
                        </div>
                    </li>


                </ul>

            </div>
            <div class="changebox">
                <p>Lorem ipsum </p>
                <a class="group1" href="img/1.jpg" title=""><img src="img/1.jpg" alt=""></a>

            </div>
            </div>
</div>
</section>

 

 

css....

  .box1 {
    position:absolute;
    width:450px;
    height:450px;
    top:20px;
    left:20px;
  }
    .box1>ul {
      position:relative;
      width:100%;
      height:100%;
    }
    .box1>ul>li {
      position:absolute;
      width:150px;
      height:150px;
      overflow: hidden;

    }
    .box1>ul>li:nth-child(1) {
      left:60px;
      top:160px;
      background:#676734;
    }
    .box1>ul>li:nth-child(2) {
      left:300px;
      top:120px;
      background:#2d2d5e;
    }
    .box1>ul>li:nth-child(3) {
      left:180px;
      top:250px;
      background:#572d5e;
    }
    .box1>ul>li:nth-child(4) {
      left:50px;
      top:390px;
      background:#5e552d;
    }
    .box1>ul>li>div {
      position: relative;
      width:100%;
      height:100%;
    }

    .box1>ul>li>div img {
      width:200px;
      height:200px;
      display: block;
      cursor: pointer;
      filter: grayscale(100%);
      transition:all 0.5s;
    }
    .box1>ul>li>div img:hover {
      filter:grayscale(0);

    }

    .changebox {
      position:absolute;
      width:450px;
      top:150px;
      left:500px;
      height:400px;
      transition:all 1s;
    }
    .changebox>img {
      width:350px;
      height:300px;
    }
 

 

 

js

$(function(){

$('.box1>ul>li:nth-child(1)').click(function () {

  $('.changebox>img').attr('src','img/1.jpg');

});


$('.box1>ul>li:nth-child(2)').click(function () {

  $('.changebox>img').attr('src','img/2.jpg');

});

$('.box1>ul>li:nth-child(3)').click(function () {

  $('.changebox>img').attr('src','img/3.jpg');

});

$('.box1>ul>li:nth-child(4)').click(function () {

  $('.changebox>img').attr('src','img/4.jpg');

});

});
 

 

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
new_usein fileZilla문의요!! [5] file 2017.03.08 by 댑펑
new_usein 설치 중 오류 문의요!! file  
이쩡2 하위 메뉴가 뜨지 않는 문재 [사례합니다.] [1] 2017.03.08 by xe_마니
닉닉 게시판이 엄청 느려요  
쿠닥 기본 URL을 변경해도 적용되지 않아요 [1] 2017.03.08 by sejin7940
소이스 메뉴 font-awesome 문의 [1] 2017.03.07 by 제이와이엔소프트
밧떼리 스케치북5 게시판 최종 버전 XE공식홈 자료실에....? [2] 2017.03.07 by 밧떼리
핫빠 설치 가이드 문의 드립니다. [1] 2017.03.07 by 너에게제공
true0 {$content}를 불러오지 못합니다. [2] file 2017.03.07 by true0
구기닷 $formTags 콜렉션은 도대체 어디에서 가져오나여? [3] 2017.03.07 by 판도라
꽃민 홈페이지 로딩시간이 8~9초입니다..ㅠㅠ [1] file 2017.03.07 by ppumweb
현대여행사 안녕하세여 [2] 2017.03.07 by ppumweb
김대영 갑자기 사이트 로그인이 안됩니다. ㅠㅠ [5] 2017.03.07 by ppumweb
소이스 업로드 문제 문의 [1] 2017.03.07 by 해외유저
소이스 게시판 문의 [2] 2017.03.07 by 소이스
xe_마니 1픽셀 가로줄 div태그 먹히지 않는 이유  
new_usein 처음 사용해보는데요~ [3] 2017.03.07 by 펭구
기억속으로 누리고 관련 사항 문의드립니다. 의미해석좀 부탁드려요  
silhwang 스케치북 최신 버전은 어디서 다운 받나요? [2] 2017.03.06 by silhwang
탱고 도와 주시면 감사하겠습니다. [2] 2017.03.06 by 탱고
보따리c28f1 가능할지 문의드립니다. [3] file 2017.03.06 by 보따리c28f1
paul**** 맥에 localhost 접속시 쉬운 설치 에러에 관하여  
우아잉 인터미션 메인화면 위젯 삭제가 안됩니다 ㅠ [1] file 2017.03.06 by 펭구
good9 이미지 본문 삽입시 여러개가 등록되는 경우...  
RTRPRSS 게시판 스킨의 테마 컬러를 skin.xml에 정의해 스타일시트에 전달하는 방법이 궁금합니다.  
sspro 스크랩글 볼때 늘 이런 오류뜨는데 무슨 오류죠? [1] file 2017.03.05 by 해외유저
tenyears 기본 레이아웃의 메뉴색상 변경 [1] file 2017.03.05 by 해외유저
올바른복장 로그인 문제 도움이 필요합니다. [1] file 2017.03.05 by 해외유저
dubu ssl 적용된 홈페이지를 만들려면 어찌하나요? [2] 2017.03.05 by 해외유저
에이스1 관리자에서 사이트 메뉴 편집 부분이 사라졌습니다. [1] file 2017.03.05 by 해외유저