Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不可见的懒加载图片滚动到可见区域后仍然不展示 #312

Closed
temper357 opened this issue May 12, 2021 · 0 comments · Fixed by #319
Closed

不可见的懒加载图片滚动到可见区域后仍然不展示 #312

temper357 opened this issue May 12, 2021 · 0 comments · Fixed by #319
Assignees
Labels
bug Something isn't working

Comments

@temper357
Copy link
Contributor

使用的 Kraken 版本 | What version of kraken are you using

master

重现步骤 | Steps To Reproduce

滚动后懒加载图片的 intersection observer 没有被触发。

重现代码 | Code example:

  it('should work with loading=lazy', (done) => {
    const img = document.createElement('img');
    // Make image loading=lazy.
    img.setAttribute('loading', 'lazy');
    img.src = 'https://gw.alicdn.com/tfs/TB1MRC_cvb2gK0jSZK9XXaEgFXa-1701-1535.png';
    img.style.width = '60px';
    img.style.height = '60px';

    let div = createElement('div', {
        style: {
          width: '100px',
          backgroundColor: 'yellow',
          height: '1000px',
        }
    });
    document.body.appendChild(div);
    document.body.appendChild(img);

    img.onload = async () => {
      await snapshot(img);
      done();
    };
  });

预期结果 | Expected results:

实际结果 | Actual results:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants