Skip to content

Instantly share code, notes, and snippets.

@quan17
quan17 / what-forces-layout.md
Created July 21, 2018 15:08 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

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()
@quan17
quan17 / cpu-intensive.js
Created October 2, 2018 18:54 — forked from sorenlouv/cpu-intensive.js
A CPU intensive operation. Use to test imitate blocking code, test WebWorkers etc.
function mySlowFunction(baseNumber) {
console.time('mySlowFunction');
var result = 0;
for (var i = Math.pow(baseNumber, 10); i >= 0; i--) {
result += Math.atan(i) * Math.tan(i);
};
console.timeEnd('mySlowFunction');
return result;
}
@quan17
quan17 / README.md
Created October 24, 2018 18:20 — forked from remarkablemark/README.md
Classes - ES5 vs ES6

JavaScript Classes - ES5 vs ES6

An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.

Reference

@quan17
quan17 / accordion-gallery-zoom-animation-css-responsive.markdown
Created November 15, 2020 18:33
accordion gallery zoom animation (css, responsive)
@quan17
quan17 / folding-cards-animation.markdown
Created November 20, 2020 02:24
Folding cards animation
@quan17
quan17 / index.html
Created November 28, 2020 21:29
Jelly Effect in Card on hover
<div class="background"></div>
<div id="curve" class="card">
<div class="footer">
<div class="connections">
<div class="connection facebook"><div class="icon"></div></div>
<div class="connection twitter"><div class="icon"></div></div>
<div class="connection behance"><div class="icon"></div></div>
</div>
<svg id="curve">
<path id="p" d="M0,200 Q80,100 400,200 V150 H0 V50" transform="translate(0 300)" />