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

Screenshots of fixed elements #48

Open
zinserjan opened this issue Nov 30, 2016 · 0 comments
Open

Screenshots of fixed elements #48

zinserjan opened this issue Nov 30, 2016 · 0 comments

Comments

@zinserjan
Copy link
Owner

Screnshots of elements with position: fixed are currently not supported. But it would be nice to support that.

I think this can be done in the following way:

  1. detect if element's position is fixed or if a parent is fixed
  2. if it isn't a fixed element, take the screenshot as usual
  3. when it's fixed, just take a screenshot of the viewport (without css-scroll) and crop it as needed

We coud use a simple script to detect if the element is fixed, like the following:

function isFixed(elem){
  do {
    if (window.getComputedStyle(elem).position == 'fixed') {
      return true;    
    } 
  } while (elem = elem.offsetParent);
  return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant