Skip to content

Instantly share code, notes, and snippets.

@makkBit
makkBit / .jsx
Last active September 19, 2020 17:15
Scroll Into View If Needed
/**
* Method to scroll into view port, if it's outside the viewport
*
* @param {Object} target - DOM Element
* @returns {undefined}
*/
const scrollIntoViewIfNeeded = target => {
// Target is outside the viewport from the bottom
if (target.getBoundingClientRect().bottom > window.innerHeight) {
// The bottom of the target will be aligned to the bottom of the visible area of the scrollable ancestor.
@makkBit
makkBit / gist:c82bf9aabd7bee60acb59b14d6afef88
Created August 30, 2018 08:58
yarn start (debugger.html)
➜ debugger.html git:(master) ✗ yarn start
yarn run v1.9.4
$ node bin/dev-server
Listening for WS on localhost:8116, all traffic is proxied to localhost:6080
Protocol messages can be logged by enabling `logging.firefoxProxy` `in /configs/local.json`
Hot Reloading - https://github.com/devtools-html/debugger.html/blob/master/docs/local-development.md#hot-reloading
View debugger examples here:
https://github.com/devtools-html/debugger-examples
Development Server Listening at http://localhost:8000
webpack: wait until bundle finished: /assets/build/debugger.js