묻고답하기

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 남기남
천풍비 맥에서 ftp 접근 이후 웹페이지가 통째로 깨져버렸습니다. file  
dualsrj**** Mac에서 MAMP으로 xe 설치시 다음과 같은 오류가 발생합니다. [1] file 2017.12.10 by HowtoXE
scone 랜덤이미지 출력후 결과 값을 고정하는 법 [1] 2017.12.10 by HowtoXE
visionpolar 홈페이지에 내용이 안 뜹니다. [1] 2017.12.10 by HowtoXE
이두바끈 사용자 데이터 통계 [1] 2017.12.10 by HowtoXE
문화사랑 1.9.0업데이트 후 홈페이지 안열려요(급함) [4] file 2017.12.10 by 휘즈
GIO php5.5->7.0 mysql->mariadb 로 변경했는데 아무것도 안나와요ㅜ,ㅜ [1] 2017.12.10 by 휘즈
혁똥 첨부파일을 포함해서 등록누르면 [1] 2017.12.10 by 혁똥
없음입니다 로그인 사이트가 따로 있습니다만... 인증 메일 폼이 다른 디자인으로 뜹니다. file  
로진 1.9.0 업데이트 후 Fatal error [2] 2017.12.08 by 로진
salsatour 검색창검색오류시 어떻게수정해야하나요? [1] file 2017.12.08 by sejin7940
thdwjdtjr 나눔고딕을 사용중인 서버에 나늠고딕 폰트를 올려놓고... [1] 2017.12.08 by sejin7940
thdwjdtjr 서버 이전 후 포인트가 먹통이 되었습니다 [4] 2017.12.08 by thdwjdtjr
이진수닷넷 자동링크에 대한 개념...!! 문의 드려봅니다... [2] file 2017.12.08 by 이진수닷넷
강희원470 사이트 정렬 문제 [2] file 2017.12.08 by 강희원470
데니안 (급질문) 버튼 팝업 부탁드립니다 ㅠㅠ [1] file 2017.12.07 by 불금
rollbbang 로그인은 되는데 dashboard로 진입이 안됩니다. [3] 2017.12.07 by rollbbang
병아리 개인컴에 서버구축후 페이지연결오류???? [2] file 2017.12.07 by 불금
:-D 다국어(언어선택) 관련 질문이 있어요! [2] file 2017.12.07 by elin
달리다굼 contact us 에서 익명으로 메일을 보낼 수 있나요? [2] file 2017.12.07 by 달리다굼