查询在浏览器中有效,但在iPhone中无效



我正在尝试使用 Jquery 制作网站,在 chrome 浏览器中它工作正常,但是如果我选择 iPhone 4 或 5 或 6,则使用浏览器中的检查选项进行测试,唯一的代码工作是切换导航栏,一旦我滚动网站,它确实会更改 DOM。

有什么帮助吗?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<link href="fonts.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<script>
x = 0;  
$(function() {

    $(".icon-menu").click(function(){
    $("nav").toggle();
    x = 0;  
});

        $(document).scroll(function(){
        $(".menu_txt").text( x=x+ 1);
        if (x > 30) {
        $("nav").hide();
        }
    });

    $(".company").click(function() {
    $('html, body').animate({
    scrollTop: $(".name_question:eq(2)").offset().top - 55
    }, 2000);
});

});
</script>

iOS 不知道是什么

$("html,body")

只试试这个

$("body")

最新更新