I found this script online http://javascript.jstruebig.de/javascript/70. I’m just wondering what this line means:
if(!width) width = document.body.offsetWidth-document.body.clientWidth;
What does the !width condition mean? If it is not initialized? Also, are there any shorter scripts that provide the same functionality?
Thanks!
!width just checks the falsey value of a variable, the more explicit check would be
client
In short, that logic just gets the width of the border and scrollbar of the page. There may be different implementations, but there is not a shorter logic than a subtraction of two operands.