Skip to content

Instantly share code, notes, and snippets.

puppeteer puppeteer701

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am dudesweet100 on github.
  • I am puppet007 (https://keybase.io/puppet007) on keybase.
  • I have a public key ASDoJb3fFPrPlOhu6IvIOfzwr1IvQKxlgrSXlz7MHbyw_Ao

To claim this, I am signing this object:

@puppeteer701
puppeteer701 / in_viewport.js
Created Jul 22, 2016 — forked from jjmu15/in_viewport.js
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
View in_viewport.js
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@puppeteer701
puppeteer701 / what-forces-layout.md
Created Sep 28, 2015 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
You can’t perform that action at this time.