A Pen by Dan Benmore on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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)" /> |
cat content ahead! ;-)
A Pen by Daniel Subat on CodePen.
An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
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.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
elem.clientLeft
,elem.clientTop
,elem.clientWidth
,elem.clientHeight
elem.getClientRects()
,elem.getBoundingClientRect()