레

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

· 2012-08-03 (금) 12:20:44 · 3967
따라다니는게 아니라 항상 제일 하단에 스티커처럼 고정되어 있는것처럼 할려면 어떻게 해야하나요?
 
참고로 경향신문 모바일입니다.
 
<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건
+
제목 글쓴이 날짜 조회
13-03-03 조회 6,198
13-03-01 조회 5,535
13-03-01 조회 8,264
13-03-01 조회 6,233
13-02-26 조회 3,851
13-02-26 조회 3,804
13-02-26 조회 4,697
13-02-24 조회 8,134
13-02-24 조회 4,216
13-02-24 조회 3,458
13-02-24 조회 5,247
13-02-24 조회 5,263
13-02-24 조회 4,335
13-02-24 조회 5,668
13-02-24 조회 9,354
13-02-14 조회 5,042
13-02-13 조회 8,968
13-01-29 조회 7,625
13-01-24 조회 4,979
13-01-24 조회 4,859
13-01-17 조회 4,256
13-01-16 조회 4,266
13-01-08 조회 4,352
12-12-27 조회 4,006
12-12-20 조회 1.1만
12-12-20 조회 3,337
12-12-06 조회 4,316
12-12-01 조회 4,060
12-11-28 조회 5,631
12-11-25 조회 5,336
12-10-20 조회 4,617
12-10-03 조회 4,752
12-09-26 조회 4,954
12-09-15 조회 8,398
12-09-14 조회 5,420
12-09-11 조회 3,904
12-09-10 조회 3,942
12-09-05 조회 8,814
12-08-29 조회 4,577
12-08-26 조회 3,730
12-08-23 조회 3,435
12-08-22 조회 3,502
12-08-22 조회 4,317
12-08-21 조회 3,472
12-08-20 조회 3,401
12-08-20 조회 9,206
12-08-15 조회 4,324
12-08-13 조회 3,233
12-08-11 조회 4,648
12-08-05 조회 4,506
12-08-03 조회 3,288
12-08-03 조회 3,968
12-08-02 조회 4,956
12-07-29 조회 4,062
12-07-26 조회 3,655
12-07-26 조회 3,521
12-07-22 조회 3,430
12-07-20 조회 3,261
12-07-19 조회 4,137
12-07-19 조회 3,390
12-07-16 조회 3,519
12-07-16 조회 4,432
12-07-15 조회 3,482
12-07-12 조회 7,337
12-07-12 조회 4,975
12-07-11 조회 3,018
12-07-09 조회 3,180
12-07-05 조회 3,793
12-07-04 조회 4,371
12-07-04 조회 3,779
12-07-04 조회 4,306
12-06-29 조회 3,755
12-06-27 조회 3,342
12-06-24 조회 3,814
12-06-22 조회 4,122
12-06-22 조회 8,542
12-06-22 조회 3,193
12-06-21 조회 3,203
12-06-17 조회 3,844
12-06-14 조회 3,938
12-06-14 조회 3,220
12-06-08 조회 4,379
12-06-06 조회 3,336
12-06-04 조회 4,084
12-05-26 조회 4,937
12-05-26 조회 3,887
12-05-25 조회 3,171
12-05-24 조회 3,276
12-05-22 조회 3,314
12-05-20 조회 2,943
12-05-16 조회 3,096
12-05-15 조회 3,488
12-05-10 조회 3,927
12-05-08 조회 3,437
12-05-04 조회 3,291
12-05-03 조회 4,228
12-05-02 조회 3,381
12-05-02 조회 3,140
12-05-02 조회 3,244
12-04-26 조회 3,400