单击IOS上的按钮时,iframe不会滚动

时间:2016-05-19 06:49:29

标签: javascript ios iphone html5 scroll

点击按钮时我想向下滚动一些元素。但它不起作用。

我使用的方法是使用查询:

if (navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)) {
    console.log('ios');

    $("html, body, .wrapper").animate({
        scrollTop: offset
    }, 500);
} else {

    $("html, body").animate({
        scrollTop: offset
    }, 500);
}

这些情况几乎相同,只是在某处看到动画不能用于ios上的html和body标签。

然而仍然无法使其发挥作用。

这是在里面:

$(".elem").click(function () {
    var offset = somenumber;
    //and the code above
});

1 个答案:

答案 0 :(得分:1)

我修复它的方式是,我使用了名为postMessage的jquery插件,这是跨域框架通信的好方法。

http://benalman.com/projects/jquery-postmessage-plugin/

相关问题