【问题标题】:how to show smooth parallax scrolling effect in mobile devices如何在移动设备中显示平滑的视差滚动效果
【发布时间】:2015-01-04 03:52:57
【问题描述】:
$('a[href^="#"]').on('click',function (e) {
                    e.preventDefault();

                    var target = this.hash;
                    $target = $(target);
                    $target.addClass('active');
                    $('html, body').stop().animate({
                        'scrollTop': $target.offset().top
                        }, 1000, 'swing');
});

HTML 代码

                        <div style="position: fixed;font-size:15px">

                                <a href="#header-wrapper">Home</a><br>
                                <a href="#about">About</a>  <br>
                                <a href="#programme">The System</a><br>


                            </div>

<div class="title" id="header-wrapper">Content</div>
<div class="title" id="about">Content</div>

<div class="title" id="programme">Content</div>

我已使用此脚本代码来显示视差效果。它在网络上完美运行,但在移动设备上却不行。如何使其在移动设备中工作。请帮忙

【问题讨论】:

    标签: jquery


    【解决方案1】:

    如何使用tap事件:

    $('a[href^="#"]').on("tap",function(){
      // Your code
    });
    

    【讨论】:

    • 点击不工作..使用点击事件即使在网络中也能移除平滑滚动。
    • 请问,您能指出您使用的是什么操作系统和浏览器吗?
    • 浏览器是 Chrome,操作系统是安卓
    • 究竟什么是行不通的?点击,动画...?
    • 在这种情况下,我没有Web桌面和移动之间的区别。可能是你手机浏览器的问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-30
    • 1970-01-01
    • 1970-01-01
    • 2019-10-17
    • 1970-01-01
    • 2015-03-05
    • 2014-11-18
    相关资源
    最近更新 更多