Added sanity check to prevent infinite loop

Added sanity check to prevent infinite looping of the while loop if the parentWidth is 0, e.g. parent is "display: none".
Merge pull request #23 from patocallaghan/master

Infinite loop of resizeSlabs 'while' if parentWidth is 0