在移动设备上禁用全页js [英] Disable fullpage js on mobile devices

查看:52
本文介绍了在移动设备上禁用全页js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图禁用移动设备的整页js,但无法正常工作.我正在使用的脚本是:

I tried to disable the fullpage js for mobile devices but it is not working. The script i am using is :

    <script>
     var isPhoneDevice = "ontouchstart" in document.documentElement; 
$(document).ready(function() {
        if(isPhoneDevice){
            //mobile
        }
            else{
                 $(document).ready(function(){
             $('#fullpage').fullpage();
        responsive: 700 // here is solution
         })
            }
        });
     </script>

网站链接: http://demo.lamppostmedia.in/arklan-dev/

帮我禁用它.

推荐答案

没有移动设备"之类的东西.不再.桌子是移动设备吗?触摸屏笔记本电脑是台式机吗?

There's no such thing as a "mobile device" anymore. Is a table a mobile device? Is a touch screen laptop consider a desktop?

解决此问题的正确方法是根据访问者正在访问的设备的分辨率来确定行为.

The right way to deal with this is basing the behaviour on the resolution of the device the visitor is accessing from.

这就是为什么 fullPage.js版本3 提供选项 responseWidth 的原因>和 responseHeight ,当您达到特定阈值时,它们可以关闭捕捉效果.

That's why fullPage.js version 3 provides the options responsiveWidth and responsiveHeight that allow you to turn off the snap effect when reaching certain threshold.

请参见 fullPage.js的响应宽度示例.

和示例代码在这里: https://github.com/alvarotrigo/fullPage.js/tree/master/例子

您可以在 fullpage.js文档中了解有关响应式选项的更多信息:

You can read more about responsive options in the the fullpage.js documentation:

responseWidth:(默认 0 )将在定义的宽度(以像素为单位)下使用常规滚动( autoScrolling:false ).如果用户想要将其 fp-响应类添加到body标签,以防其希望将其用于自己的响应CSS.例如,如果设置为900,则每当浏览器的宽度小于900时,插件就会像正常站点一样滚动.

responsiveWidth: (default 0) A normal scroll (autoScrolling:false) will be used under the defined width in pixels. A class fp-responsive is added to the body tag in case the user wants to use it for their own responsive CSS. For example, if set to 900, whenever the browser's width is less than 900 the plugin will scroll like a normal site.

responseHeight:(默认 0 )将在定义的高度(以像素为单位)下使用普通滚动( autoScrolling:false ).如果用户想要将其 fp-响应类添加到body标签,以防其希望将其用于自己的响应CSS.例如,如果设置为900,则每当浏览器的高度小于900时,插件就会像正常站点一样滚动.

responsiveHeight: (default 0) A normal scroll (autoScrolling:false) will be used under the defined height in pixels. A class fp-responsive is added to the body tag in case the user wants to use it for their own responsive CSS. For example, if set to 900, whenever the browser's height is less than 900 the plugin will scroll like a normal site.

这篇关于在移动设备上禁用全页js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆