레

따라다니는 배너 스크립트인데요

· 2012-08-03 (금) 12:20:44 · 4118
따라다니는게 아니라 항상 제일 하단에 스티커처럼 고정되어 있는것처럼 할려면 어떻게 해야하나요?
 
참고로 경향신문 모바일입니다.
 
<script type="text/javascript">
var adObj = document.createElement("DIV");
adObj.id="dualad_div34";
adObj.style.zindex="999";
adObj.style.position="absolute";
adObj.style.bottom="0px";
adObj.style.left="0px";
adObj.style.width="100%";
adObj.style.height="50px";
document.body.appendChild(adObj);
var daum_adam_vars = {
 position : 'MIDDLE',  // TOP (화면상단) | BOTTOM (화면 하단) | MIDDLE (화면 중간 삽입. bannerDivId 지정 필요)
 bannerDivId : 'dualad_div34',  // position : 'MIDDLE' 인 경우, 광고를 삽입할 DIV 테그의 ID 값.
};
function setAdPosition(target, position, topLimit, btmLimit) {
    if (!target) return false;
    var obj = target;
    obj.initTop = position;
    obj.topLimit = topLimit;
    obj.bottomLimit = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) - btmLimit - obj.offsetHeight;
    obj.style.position = "absolute";
    obj.top = obj.initTop;
    obj.left = obj.initLeft;
    if (typeof (window.pageYOffset) == "number") {
        obj.getTop = function () {
            return window.pageYOffset;
        }
    } else if (typeof (document.documentElement.scrollTop) == "number") {
        obj.getTop = function () {
            return Math.max(document.documentElement.scrollTop, document.body.scrollTop);
        }
    } else {
        obj.getTop = function () {
            return 0;
        }
    }
    if (self.innerHeight) {
        obj.getHeight = function () {
            return self.innerHeight;
        }
    } else if (document.documentElement.clientHeight) {
        obj.getHeight = function () {
            return document.documentElement.clientHeight;
        }
    } else {
        obj.getHeight = function () {
            return 500;
        }
    }
    if (obj.initTop > 0) {
        pos = obj.getTop() + obj.initTop;
    } else {
        pos = obj.getTop() + obj.getHeight() + obj.initTop;
    }
    if (pos > obj.bottomLimit) pos = obj.bottomLimit;
    if (pos < obj.topLimit) pos = obj.topLimit;
    obj.style.top = (obj.top + pos) + "px";
}
document.body.addEventListener('touchstart', function (e) {
    var evt = e || window.event;
    var target = evt.target || evt.srcElement;
    var node = target.parentNode;
    var hide = true;
    while (node) {
        if (node.id === daum_adam_vars.bannerDivId) {
            hide = false;
            break;
        }
        node = node.parentNode;
    }
    if (hide) {
        document.getElementById('dualad_div34').style.display = 'none';
    }
}, false);
window.addEventListener('scroll', function () {
    setAdPosition(document.getElementById("dualad_div34"), - 30, 0, - 30);
    document.getElementById('dualad_div34').style.display = 'block';
}, false);

window.addEventListener('load', function() {
 if (navigator.userAgent.indexOf('Safari')!=-1){
  setTimeout(scrollTo,0,0,1);
 }else{
  window.scrollTo(0,1);
 }
 setTimeout("setAdPosition(document.getElementById('dualad_div34'), -24, 0, -24)",1);
}, false);
</script>
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,187건
+
제목 글쓴이 날짜 조회
12-06-21 조회 4,047
12-06-21 조회 3,578
12-06-20 조회 3,749
12-06-20 조회 4,304
12-06-20 조회 3,393
12-06-20 조회 4,733
12-06-20 조회 3,383
12-06-20 조회 3,338
12-06-20 조회 4,152
12-06-20 조회 4,374
12-06-18 조회 4,907
12-06-18 조회 3,562
12-06-18 조회 3,689
12-06-18 조회 3,482
12-06-18 조회 4,230
12-06-18 조회 4,887
12-06-17 조회 4,093
12-06-17 조회 4,005
12-06-17 조회 3,644
12-06-16 조회 3,438
12-06-15 조회 3,260
12-06-15 조회 3,960
12-06-15 조회 4,711
12-06-15 조회 4,439
12-06-14 조회 4,079
12-06-14 조회 4,096
12-06-14 조회 3,185
12-06-14 조회 3,595
12-06-14 조회 4,900
12-06-14 조회 3,381
12-06-14 조회 3,237
12-06-13 조회 7,465
12-06-13 조회 3,715
12-06-12 조회 5,687
12-06-11 조회 3,570
12-06-11 조회 3,581
12-06-11 조회 3,574
12-06-11 조회 3,478
12-06-11 조회 4,041
12-06-11 조회 3,355
12-06-08 조회 3,421
12-06-08 조회 4,914
12-06-08 조회 3,234
12-06-08 조회 4,993
12-06-08 조회 4,007
12-06-08 조회 3,545
12-06-08 조회 3,498
12-06-08 조회 4,513
12-06-08 조회 3,132
12-06-08 조회 3,815
12-06-07 조회 4,107
12-06-07 조회 4,000
12-06-06 조회 3,402
12-06-06 조회 3,485
12-06-06 조회 3,788
12-06-06 조회 6,466
12-06-06 조회 6,034
12-06-06 조회 6,780
12-06-05 조회 5,893
12-06-05 조회 3,309
12-06-05 조회 3,397
12-06-05 조회 3,410
12-06-05 조회 1.2만
12-06-05 조회 5,061
12-06-05 조회 5,567
12-06-05 조회 5,338
12-06-05 조회 5,680
12-06-05 조회 3,634
12-06-05 조회 3,564
12-06-05 조회 7,435
12-06-04 조회 3,400
12-06-04 조회 4,250
12-06-04 조회 3,970
12-06-04 조회 4,032
12-06-03 조회 3,876
12-06-02 조회 3,274
12-06-02 조회 3,999
12-06-01 조회 3,424
12-06-01 조회 4,175
12-06-01 조회 3,740
12-06-01 조회 3,367
12-06-01 조회 4,884
12-06-01 조회 3,741
12-06-01 조회 3,353
12-05-31 조회 5,035
12-05-31 조회 3,842
12-05-31 조회 3,777
12-05-31 조회 3,768
12-05-31 조회 3,579
12-05-30 조회 3,230
12-05-30 조회 3,277
12-05-30 조회 4,092
12-05-30 조회 3,339
12-05-29 조회 4,547
12-05-29 조회 3,873
12-05-28 조회 3,254
12-05-28 조회 6,705
12-05-28 조회 3,337
12-05-27 조회 4,667
12-05-27 조회 3,920