Fixed compatibility with bootstrap responsive.js

Fixed bug where while loop would not quit due to startPos and endPos being both 0.