Execute function if document is taller than viewport
问题 This is some quite strange behaviour I experience. I want to execute a function only when the document is taller than the viewport (i.e. it overflows it and a scrollbar appears). I use this code: var docH = $("document").height(), viewPortH = $("window").height(); if (docH > viewPortH) { // execute functions } But nothing happens and console returns: Uncaught TypeError: Cannot read property 'parent' of null Does anyone know what the problem is/what code I should use to see whether the