채택완료

for문 재질문

2019-03-05 (화) 11:58:23 2,252

안녕하세요

아래 질문글에 설명을 잘못한것 같습니다.

예상 실행 결과입니다.

2038638456_1551754640.3781.png

이런식으로 출력되길 원합니다.

Copy
<div class="pic_lt_bottom">

    <div class="owl-carousel-bottom owl-theme">

    <?php

    for ($i=0; $i<count($list); $i++) {

    $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
 

    if($thumb['src']) {

        $img = $thumb['src'];

    } else {

        $img = G5_IMG_URL.'/no_img.png';

        $thumb['alt'] = '이미지가 없습니다.';

    }

    $img_content[$i] = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';

    ?>

        <div class="item">

            <a href="<?php echo $list[$i]['href'] ?>"><?php echo $img_content[$i]; ?></a>

        </div>

    <?php }  ?>

    <?php if (count($list) == 0) { //게시물이 없을 때  ?>

    <li class="empty_li">게시물이 없습니다.</li>

    <?php }  ?>

  </div>

</div>

<script>

            $(document).ready(function() {

              var owl2 = $('.owl-carousel-bottom');

              owl2.owlCarousel({

                loop: true,

                margin: 20,

                nav:false,

                autoplay: true,

                autoplayTimeout: 3000,

                autoplayHoverPause: true,

                responsiveClass:true,

                responsive:{

                  0:{

                    items:1,

                    nav:false

                  },

                  500:{

                    items:2,

                    nav:false

                  },

                  1000:{

                    items:3,

                    nav:false,

                  }

                }

              });

            })

          </script>
|

답변 1개

채택된 답변
+20 포인트
2019-03-05 (화) 12:15:24

이미지 6개를 2줄에 3개씩 하시려면 출력을 items로 6개 하셔야될거같은데욥..responsive에서 pc일때 width값 하나 찍으시고 items:6을 주시고 css에서 이미지1개당 width값을 calc(100% / 3)하셔야될거같습니다

답변을 작성하려면 로그인이 필요합니다.