Fix javascript error with fromTop

If the element that calls fromTop do not exist we don't want to fail all js, now returns 0 by default.