레

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

· 2012-08-03 (금) 12:20:44 · 4123
따라다니는게 아니라 항상 제일 하단에 스티커처럼 고정되어 있는것처럼 할려면 어떻게 해야하나요?
 
참고로 경향신문 모바일입니다.
 
<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-11-22 조회 4,838
12-11-22 조회 6,367
12-11-22 조회 6,411
12-11-22 조회 5,367
12-11-22 조회 8,594
12-11-21 조회 6,122
12-11-21 조회 8,697
12-11-20 조회 4,973
12-11-20 조회 2.4만
12-11-19 조회 4,118
12-11-19 조회 4,608
12-11-19 조회 2만
12-11-18 조회 5,528
12-11-16 조회 4,164
12-11-16 조회 6,554
12-11-16 조회 4,285
12-11-16 조회 4,535
12-11-15 조회 3,885
12-11-15 조회 5,674
12-11-15 조회 4,552
12-11-15 조회 3,840
12-11-14 조회 3,628
12-11-14 조회 1만
12-11-14 조회 5,100
12-11-13 조회 4,121
12-11-13 조회 3,924
12-11-12 조회 5,739
12-11-12 조회 4,118
12-11-11 조회 2.2만
12-11-09 조회 5,690
12-11-09 조회 5,875
12-11-09 조회 7,778
12-11-08 조회 4,978
12-11-06 조회 3,913
12-11-06 조회 4,072
12-11-06 조회 1.9만
12-11-05 조회 4,049
12-11-05 조회 4,945
12-11-05 조회 4,456
12-11-05 조회 4,198
12-11-04 조회 4,156
12-11-03 조회 4,241
12-11-03 조회 2.6만
12-11-02 조회 5,256
12-11-02 조회 3.2만
12-11-01 조회 5,245
12-11-01 조회 2.6만
12-10-30 조회 8,443
12-10-30 조회 3,962
12-10-29 조회 4,004
12-10-29 조회 5,268
12-10-29 조회 4,094
12-10-29 조회 4,942
12-10-28 조회 4,165
12-10-26 조회 3,928
12-10-26 조회 9,944
12-10-26 조회 8,228
12-10-25 조회 4,083
12-10-25 조회 4,161
12-10-25 조회 8,276
12-10-24 조회 9,748
12-10-23 조회 4,183
12-10-23 조회 3,442
12-10-23 조회 3,762
12-10-23 조회 5,006
12-10-22 조회 8,585
12-10-21 조회 4,106
12-10-20 조회 4,749
12-10-19 조회 4,560
12-10-19 조회 3,543
12-10-18 조회 4,185
12-10-18 조회 3,806
12-10-18 조회 3,641
12-10-17 조회 9,462
12-10-17 조회 3,759
12-10-16 조회 3,614
12-10-16 조회 5,683
12-10-16 조회 4,121
12-10-16 조회 6,468
12-10-16 조회 4,309
12-10-15 조회 4,041
12-10-15 조회 3,554
12-10-15 조회 3,542
12-10-14 조회 3,883
12-10-13 조회 3,908
12-10-12 조회 4,806
12-10-12 조회 4,121
12-10-11 조회 5,165
12-10-11 조회 4,164
12-10-10 조회 7,172
12-10-10 조회 6,505
12-10-10 조회 8,099
12-10-10 조회 1.1만
12-10-10 조회 5,746
12-10-10 조회 5,297
12-10-10 조회 3,638
12-10-09 조회 6,100
12-10-09 조회 3,843
12-10-09 조회 7,391
12-10-09 조회 5,559