簡體   English   中英

jQuery.ScrollTo-如何使BG滾動慢於其他?

[英]jQuery.ScrollTo - how to make bg to scroll slower than the rest?

我是編碼的新手,也是這個網站的新手,希望您能對我有所幫助! 因此,我要創建水平網站,我想添加滾動背景,該滾動背景會單擊其他元素,但速度較慢,例如http://hotdot.pro/en/ 我該怎么做,我在哪里放置代碼行?

也許我可以使用更好的插件?

謝謝你的幫助!

!!我把腳本代碼放在這里只是因為網站說我的帖子不夠豐富。 抱歉

<script>

$(document).ready(function() {

    $('a.panel').click(function () {

        $('a.panel').removeClass('selected');
        $(this).addClass('selected');

        current = $(this);

        $('#wrapper').scrollTo($(this).attr('href'), 800);      

        return false;
    });

    $(window).resize(function () {
        resizePanel();
    });

});

function resizePanel() {

    width = $(window).width();
    height = $(window).height();

    mask_width = width * $('.item').length;

    $('#debug').html(width  + ' ' + height + ' ' + mask_width);

    $('#wrapper, .item').css({width: width, height: height});
    $('#mask').css({width: mask_width, height: height});
    $('#wrapper').scrollTo($('a.selected').attr('href'), 0);

}

</script>

要么

哪里?

jQuery Parallax插件可能就是您想要的。

在此處查看演示: http : //ianlunn.co.uk/plugins/jquery-parallax/

源代碼和文檔在這里: https : //github.com/IanLunn/jQuery-Parallax

“或者也許我可以使用更好的插件”-經驗法則是:只要有可能使用已經編寫的代碼(而不是自己編寫),就應該這樣做。 除上述情況外,編寫代碼是一項學術活動。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM