따라다니는 베너 작성중입니다.

따라다니는 베너 작성중입니다.

QA

따라다니는 베너 작성중입니다.

답변 2

본문

왜 적용이 안되는지 궁금합니다.

https://woosungent.com/index2.php


html

<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.js"></script> 
<body>
  <div class="sideBanner">
    <span class="txt-label">
      Banner Data...    
    </span>
  </div>
</body>

css

body { height: 2000px; }

.sideBanner {
  position: absolute;
  width: 150px;
  height: 200px;
  top: 50px;
  background-color: #999900;
  color: #fffffff;
}

 
js

// 기본 위치(top)값
var floatPosition = parseInt($(".sideBanner").css('top'))

// scroll 인식
$(window).scroll(function() {
  
    // 현재 스크롤 위치
    var currentTop = $(window).scrollTop();
    var bannerTop = currentTop + floatPosition + "px";

    //이동 애니메이션
    $(".sideBanner").stop().animate({
      "top" : bannerTop
    }, 500);

}).scroll();

 

이 질문에 댓글 쓰기 :

답변 2

잘 되는데..

z-index:99999999999999 추가해 보세요.

안녕하세요.

아래의 내용을 참고해 보세요~

 

.sideBanner {
  position: fixed;
  width: 150px;
  height: 200px;
  top: 50px;
  background-color: #999900;
  color: #fffffff;
}
 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 742
© SIRSOFT
현재 페이지 제일 처음으로