레

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

· 2012-08-03 (금) 12:20:44 · 3948
따라다니는게 아니라 항상 제일 하단에 스티커처럼 고정되어 있는것처럼 할려면 어떻게 해야하나요?
 
참고로 경향신문 모바일입니다.
 
<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,188건
+
제목 글쓴이 날짜 조회
12-09-05 조회 7,365
12-08-31 조회 5,779
12-08-30 조회 6,550
12-08-22 조회 1.2만
12-08-09 조회 5,569
12-08-02 조회 3,650
12-07-30 조회 3,971
12-07-15 조회 3,630
12-07-10 조회 3,537
12-07-06 조회 3,387
12-07-06 조회 3,352
12-07-03 조회 3,955
12-07-03 조회 3,447
12-07-02 조회 3,346
12-06-25 조회 3,819
12-06-20 조회 3,186
12-06-15 조회 3,769
12-06-14 조회 3,045
12-06-08 조회 3,849
12-06-07 조회 3,832
12-06-05 조회 5,694
12-06-05 조회 3,441
12-06-04 조회 3,784
12-06-01 조회 3,983
12-06-01 조회 4,736
12-06-01 조회 3,587
12-05-30 조회 3,153
12-05-28 조회 3,097
12-05-23 조회 3,193
12-05-18 조회 3,121
12-05-16 조회 3,155
12-05-16 조회 3,135
12-05-16 조회 4,411
12-05-16 조회 2,936
12-05-16 조회 2,937
12-05-16 조회 3,325
12-05-16 조회 3,091
12-05-16 조회 2,977
12-05-15 조회 3,147
12-05-15 조회 2,827
12-05-15 조회 3,081
12-05-15 조회 3,516
12-05-15 조회 3,253
12-05-15 조회 2,632
12-05-14 조회 2,663
12-05-14 조회 2,836
12-05-14 조회 2,804
12-05-14 조회 3,102
12-05-14 조회 2,909
12-05-11 조회 3,224
12-05-11 조회 2,757
12-05-11 조회 2,648
12-05-11 조회 2,750
12-05-11 조회 3,327
12-05-11 조회 2,514
12-05-10 조회 3,918
12-05-10 조회 2,771
12-05-10 조회 2,698
12-05-10 조회 2,839
12-05-10 조회 4,440
12-05-10 조회 2,482
12-05-10 조회 2,583
12-05-10 조회 2,439
12-05-10 조회 2,692
12-05-10 조회 3,143
12-05-10 조회 3,419
12-05-10 조회 2,655
12-05-10 조회 2,770
12-05-10 조회 3,252
12-05-10 조회 2,829
12-05-08 조회 3,045
12-05-08 조회 2,863
12-05-08 조회 2,883
12-05-08 조회 3,257
12-05-08 조회 4,439
12-05-03 조회 2,820
12-05-03 조회 2,935
12-05-03 조회 2,685
12-05-03 조회 3,774
12-05-03 조회 2,820
12-05-02 조회 2,855
12-04-27 조회 2,747
12-04-27 조회 2,817
12-04-27 조회 2,736
12-04-26 조회 2,695
12-04-26 조회 3,060
12-04-26 조회 3,005
12-04-26 조회 2,674
12-04-26 조회 3,002
12-04-26 조회 3,604
12-04-26 조회 2,879
12-04-26 조회 3,546
12-04-26 조회 2,606
12-04-26 조회 2,939
12-04-26 조회 2,671
12-04-26 조회 2,919
12-04-26 조회 2,676
12-04-26 조회 3,103
12-04-26 조회 3,155
12-04-26 조회 2,941