레

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

· 2012-08-03 (금) 12:20:44 · 4114
따라다니는게 아니라 항상 제일 하단에 스티커처럼 고정되어 있는것처럼 할려면 어떻게 해야하나요?
 
참고로 경향신문 모바일입니다.
 
<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-05-26 조회 4,139
12-05-26 조회 3,470
12-05-26 조회 5,054
12-05-26 조회 4,002
12-05-26 조회 3,528
12-05-25 조회 3,689
12-05-25 조회 3,299
12-05-25 조회 3,202
12-05-25 조회 3,286
12-05-25 조회 3,412
12-05-25 조회 3,246
12-05-25 조회 3,323
12-05-25 조회 3,247
12-05-25 조회 4,064
12-05-25 조회 3,420
12-05-24 조회 3,033
12-05-24 조회 3,005
12-05-24 조회 3,389
12-05-24 조회 3,349
12-05-24 조회 4,702
12-05-24 조회 4,062
12-05-23 조회 3,364
12-05-23 조회 4,139
12-05-23 조회 3,341
12-05-23 조회 4,478
12-05-23 조회 3,639
12-05-22 조회 6,707
12-05-22 조회 3,952
12-05-22 조회 3,474
12-05-22 조회 3,250
12-05-21 조회 3,013
12-05-21 조회 4,008
12-05-21 조회 3,661
12-05-21 조회 5,214
12-05-20 조회 3,102
12-05-19 조회 3,488
12-05-19 조회 3,029
12-05-18 조회 3,088
12-05-18 조회 3,100
12-05-18 조회 3,663
12-05-18 조회 3,275
12-05-18 조회 3,495
12-05-18 조회 5,077
12-05-17 조회 4,118
12-05-17 조회 4,112
12-05-17 조회 4,028
12-05-17 조회 4,815
12-05-16 조회 3,305
12-05-16 조회 3,279
12-05-16 조회 4,546
12-05-16 조회 3,082
12-05-16 조회 3,073
12-05-16 조회 3,462
12-05-16 조회 3,228
12-05-16 조회 3,103
12-05-16 조회 3,200
12-05-16 조회 3,405
12-05-15 조회 3,587
12-05-15 조회 3,228
12-05-15 조회 4,191
12-05-15 조회 3,262
12-05-15 조회 2,941
12-05-15 조회 3,183
12-05-15 조회 3,624
12-05-15 조회 3,354
12-05-15 조회 2,739
12-05-15 조회 3,307
12-05-15 조회 3,749
12-05-14 조회 2,764
12-05-14 조회 2,932
12-05-14 조회 2,905
12-05-14 조회 3,211
12-05-14 조회 3,030
12-05-14 조회 3,196
12-05-13 조회 3,482
12-05-12 조회 3,651
12-05-11 조회 2,942
12-05-11 조회 3,308
12-05-11 조회 7,156
12-05-11 조회 3,343
12-05-11 조회 2,867
12-05-11 조회 2,781
12-05-11 조회 2,864
12-05-11 조회 3,437
12-05-11 조회 2,619
12-05-10 조회 4,007
12-05-10 조회 4,014
12-05-10 조회 2,860
12-05-10 조회 2,786
12-05-10 조회 2,931
12-05-10 조회 4,532
12-05-10 조회 2,571
12-05-10 조회 2,660
12-05-10 조회 2,527
12-05-10 조회 2,801
12-05-10 조회 3,253
12-05-10 조회 3,537
12-05-10 조회 2,783
12-05-10 조회 2,895
12-05-10 조회 3,396