將discuz x2返回頂部的按鈕x1.5中實(shí)現(xiàn)步驟

字號(hào):


    很多人都想讓x2中的返回頂部移動(dòng)到1.5上,那么下面我就教大家如何將這個(gè)功能移動(dòng)到1.5上。
    首先打開x2安裝包你需要講一下幾處的代碼移動(dòng)到 1.5中。
    1.打開x2中的./static/js/common.js找到這段js函數(shù)將它復(fù)制到x1.5中的./static/js/common.js文件底部。
    function showtoplink() {
    if($('ft')){
    var viewportheight = parseint(document.documentelement.clientheight);
    var scrollheight = parseint(document.body.getboundingclientrect().top);
    var basew = parseint($('ft').clientwidth);
    var sw = $('scrolltop').clientwidth;
    if (basew < 1000) {
    var left = parseint(fetchoffset($('ft'))['left']);
    left = left < sw ? left * 2 - sw : left;
    $('scrolltop').style.left = ( basew + left ) + 'px';
    } else {
    $('scrolltop').style.left = 'auto';
    $('scrolltop').style.right = 0;
    }
    if (browser.ie && browser.ie < 7) {
    $('scrolltop').style.top = viewportheight - scrollheight - 150 + 'px';
    }
    if (scrollheight < -100) {
    $('scrolltop').style.visibility = 'visible';
    } else {
    $('scrolltop').style.visibility = 'hidden';
    }
    }
    }
    2.找到x2中的./template/default/common/footer.htm,將以下代碼
    <span id=scrolltop>{lang scrolltop}</span>
    <script type=text/javascript>_attachevent(window, 'scroll', function(){showtoplink();});</script>
    復(fù)制到x1.5中的./template/default/common/footer.htm文件中的<!--{eval output();}-->這段代碼的上面。
    3.找到找到x2中的./template/default/common/common.css,將以下代碼
    #scrolltop { visibility: hidden; position: fixed; bottom: 100px; display: block; margin: -30px 0 0; width: 26px; height: 50px; background: url({imgdir}/scrolltop.png) no-repeat 50% 0; line-height: 999px; overflow: hidden; cursor: pointer; }
    .ie6 #scrolltop { position: absolute; bottom: auto; }
    復(fù)制到x1.5中的./template/default/common/common.css文件中.
    4.找到找到x2中的./static/image/common/scrolltop.png復(fù)制到x1.5中的./static/image/common/文件中.
    然后更新緩存。前臺(tái)刷新頁面看看吧