So, based on Eyal's comment, I was curious what was happening at the root of this problem. On my system, I noticed that Chrome is wrapped, but IE and FF did not. After more digging, I found that the wrapper was caused by the display area of the screen.
You determine the size of the parent using jQuery, but when dividing by three you are going to round. In some cases, rounding causes the container to be too narrow for images and third wrappers. If it is rounded, then you have enough space and the wrap does not occur.
The solution posted below is a more robust answer as it automatically recounts the size of the browser. You will have to run js all the time and keep track of resizing to handle this with JS. Hope this helps.
Instead of using javascript, can you use CSS instead?
Set student to display:inline . Then set parent to white-space:nowrap . They will not turn around. Then you need to handle the spaces between the images. Since we have now set them to inline , any spaces in the html will cause a space. Therefore, if you set "font-size: 0px" in the image container, it resets the space. Remember to set the font to a positive value if the containers should contain text. No need to mess with js.
http://jsfiddle.net/U3gBG/8/
body { padding: 0; margin: 0; overflow: hidden; } html, body { height: 100%; } .classroom { white-space: nowrap; height: 100%; font-size: 0px; } .classroom .student { height: 100%; display: inline; } .classroom .student .student-image { height: 100%; }
mrtsherman
source share