【问题标题】:Vertical Inverse scrolling and Horizontal scrolling垂直反向滚动和水平滚动
【发布时间】:2014-07-12 08:21:02
【问题描述】:

我访问过the site。在那里您可以看到水平滚动,在第 4 级中,您可以看到反向垂直滚动。我怎样才能做到这一点。只需使用css3 或使用其他一些资源,例如JS

提前致谢。

【问题讨论】:

    标签: javascript html css user-interface web


    【解决方案1】:

    使用 Jquery,您可以执行以下操作:

    $(function() {
    
       $("body").mousewheel(function(event, delta) {
    
          this.scrollLeft -= (delta * 30);
    
          event.preventDefault();
    
       });
    
    });
    

    Demotutorial

    window.onscroll=function() {
        var scroll = window.scrollY;
        $('article').css('left', '-' + scroll + 'px');
    }
    

    确保 css 适合

    section {
        overflow:hidden;
        height:1024px;
    }
    article {
        width:1024px;/*same as section's height*/
        position:fixed; /*you need this to fixe the V-scroll*/
    }
    article p {
        float:left;
    }
    

    HTML

    <section>
        <article>
    
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting </p>
    
        </article>
    </section>
    

    【讨论】:

    • 感谢您的回答。我也在搜索反向垂直滚动的结果,如示例链接所示。
    • 只是为背景图像设置动画是视差
    猜你喜欢
    • 2014-01-09
    • 1970-01-01
    • 2021-11-13
    • 1970-01-01
    • 2020-08-17
    • 2015-05-31
    • 2013-11-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多