Skip to content

Instantly share code, notes, and snippets.

@leviua
leviua / findOverflowParents.js
Created September 26, 2023 17:20 — forked from brandonjp/findOverflowParents.js
find overflow:hidden ancestors
// when you're trying to use `position:sticky` on an element
// you'll have trouble if any parent/ancestor element has
// overflow set to anything other than "visible" (such as: auto,hidden,overlay,scroll)
// & turns out if a parent is `display:flex` it might need some love
// (to remedy this you can set the `align-self` of your sticky element)
// see here for how the display & align-self properties affect: http://bit.ly/2ZaRu4o
// so, to find those troublesome parents...
// copy & paste this into Chrome Inspector/Dev Tools console
// (and be sure to change the #stickyElement below, if needed)
(function() {
var standardGlobals = ["top","window","location","external","chrome","document","inlineCSS","target","width","height","canvas","data","DOMURL","img","svg","ctx","url","w","a","speechSynthesis","webkitNotifications","localStorage","sessionStorage","applicationCache","webkitStorageInfo","indexedDB","webkitIndexedDB","crypto","CSS","performance","console","devicePixelRatio","styleMedia","parent","opener","frames","self","defaultstatus","defaultStatus","status","name","length","closed","pageYOffset","pageXOffset","scrollY","scrollX","screenTop","screenLeft","screenY","screenX","innerWidth","innerHeight","outerWidth","outerHeight","offscreenBuffering","frameElement","clientInformation","navigator","toolbar","statusbar","scrollbars","personalbar","menubar","locationbar","history","screen","postMessage","close","blur","focus","ondeviceorientation","ondevicemotion","onunload","onstorage","onresize","onpopstate","onpageshow","onpagehide","ononline","onoffline","onmessage","onhashchange","onbeforeunlo
@leviua
leviua / generator.coffee
Created March 27, 2015 10:54
uid generator
s1: ->
(((1+Math.random())*0x10000)|0).toString(16).substring(1)
uid: ->
(@s1() + @s1())
@leviua
leviua / react + $.sortable
Last active August 29, 2015 14:16
Creating sortable list with react and $.sortable.
Parent = React.createClass
displayName: 'Parent'
getInitialState: ->
{
panels: []
}
componentDidMount: ->
dom = $('.mltvlvlist')
dom.sortable {
cancel: ".bigpanel"