본문 바로가기
IT/jsp

vTicker 활용한 롤링배너 사용하기

by 김보리 2022. 6. 7.
728x90
반응형

vticker를 활용한 배너 롤링

js 소스
$(function(){
      $('#rollingBanner').vTicker();
      /* $('#rollingBanner').vTicker({
           speed: 700,
           pause: 4000,
           animation: 'fade',
           mousePause: false,
           showItems: 1
       }); */
       
      // 다음배너로 이동 next
      $('#next').click(function() {
         $('#rollingBanner').vTicker('next', {animate:true});
      });        
      $('#next').click(function() {
         $('#rollingBanner').vTicker('next', {animate:false});
      });        
      
      // 이전배너로 이동 prev
      $('#prev').click(function() {
         $('#rollingBanner').vTicker('prev', {animate:true});
      });
      
      $('#prev').click(function() {
         $('#rollingBanner').vTicker('prev', {animate:false});
      });
   });

 

html 소스
<div class="row mb-2">
                      <div class="col-sm-12">
                         <div class="card">
                            <div class="card-body" >
                               <div class="col-sm-12" id="rollingBanner">
                               <!-- <ul class="mb-5">
                                  <li><h5>배너1</h5></li>
                                  <li><h5>배너2</h5></li>
                                  <li><h5>배너3</h5></li>
                                  <li><h5>배너4</h5></li>
                               </ul>
                               <a href="#" class="bx bx-caret-up" style="float: right;"></a><br>
                               <a href="#" class="bx bx-caret-down" style="float: right;"></a> -->
                                  <ul class="mb-4">
                                     <li><h5>배너1</h5></li>
                                     <li><h5>배너2</h5></li>
                                     <li><h5>배너3</h5></li>
                                     <li><h5>배너4</h5></li>
                                  </ul>
                                  <div class="btnBox">
                                     <span class="nextBtn">
                                        <a href="#" class="bx bx-caret-down" id="next" style="float: right; margin-top: 5px;"></a>
                                     </span>
                                     <span class="prevBtn">
                                        <a href="#" class="bx bx-caret-up" id="prev" style="float: right; margin-top: 5px;"></a>
                                     </span>
                                  </div>
                               </div>
                            </div>
                         </div>
                      </div>
                   </div>

 

실행결과

 

버튼 클릭시 실행결과

728x90
반응형

'IT > jsp' 카테고리의 다른 글

jsp 팝업창 게시 기한 설정하기  (0) 2022.06.14
jsp 퀵메뉴, top버튼 만들기  (0) 2022.06.13
jsp 팝업창 이동하기  (0) 2022.06.13
즐겨찾기 추가 및 해제 구현하기  (0) 2022.06.08
jsp 팝업창 만들기  (0) 2022.06.07

댓글