squidfunk / karma-viewport

A Karma plugin for testing responsive features and layout

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a good way to test scrolling within the viewport?

makeros opened this issue · comments

Hello.
I just want to test scrolling behavior on different viewport sizes.
Right now i'm scrolling viewport content with viewport.el_.contentWindow.scrollTo(0,101). But then i need also to reset scrollTop after each test.
I'm just curious if there is a better approach for this.

Thanks for your thoughts. Currently there's no way. I have to think about if it makes sense including this into the codebase.

This is finally implemented in #34 - there's a new method called offset that proxies calls to the content window:

viewport.offset(0, 10) // scroll 10px down

Scroll offset is also reset when reset is called. Should be ready soon.

Released as part of 1.0.0.

ezoic increase your site revenue