小编ksz*_*ram的帖子

移动Safari,scrollIntoView不起作用

我在iframe的移动Safari上滚动到元素时遇到问题(它可在其他浏览器上使用,包括在Mac上的Safari)。

我使用scrollIntoView。当所有contnet都呈现后,我想滚动。这是我的代码:

var readyStateCheckInterval = setInterval(function () {
    if (document.readyState === "complete") {
       clearInterval(readyStateCheckInterval);
        $browser.notifyWhenNoOutstandingRequests(function () {
            if (cinemaName != null && eventId == null) {
                scrollToCinema();
            } else {
                scrollToEvent();
            }
        });
     }
}, 10);


function scrollToEvent() {
    var id = eventId;
    var delay = 100;

    if (cinemaName != null) {
        id = cinemaName + "#" + eventId;
    }

    if ($rootScope.eventId != null) {
        id = $rootScope.cinemaId + "#" + $rootScope.eventId;
    }

    $timeout(function () {
        var el = document.getElementById(id); …
Run Code Online (Sandbox Code Playgroud)

javascript safari iframe mobile-safari ios

5
推荐指数
2
解决办法
6121
查看次数

标签 统计

iframe ×1

ios ×1

javascript ×1

mobile-safari ×1

safari ×1