The code I posted on this link works fine, but has one limitation – if the site visitor changes the resolution (rotates the mobile phone or tablet device), the stacking will remain as it was in the first place. And this translates into layout errors. Hence the client requested for a way to avoid this – one of the ideas is to reload the website on resolution (orientation) change. Here’s the snippet that worked for me:
1 2 3 4 5 6 7 8 9 10 |
jQuery(document).ready(function($){ var windowWidth = $(window).width(); $(window).resize(function() { if(windowWidth != $(window).width()){ location.reload(); return; } }); }); |