garywhitling Posted June 21, 2018 Share Posted June 21, 2018 Hi, I was wondering if anyone knows of some code that can be added to "Refresh" the page or the main menu anytime the web browser is resized on a desktop. I don't need this to happen when the site is being viewed on a mobile or tablet, only for the desktop view. Basically, I have a problem with a menu layout that doesn't resize it's self correctly when the web browser is resized manually. Any Suggestions? Regards Gary Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted June 21, 2018 Share Posted June 21, 2018 https://stackoverflow.com/questions/2996431/detect-when-a-window-is-resized-using-javascript Does that help? Be careful it doesn't refresh too many times as it resizes. Quote Link to comment Share on other sites More sharing options...
Noodleman Posted June 21, 2018 Share Posted June 21, 2018 if you no code, you can embed some hidden div's with unique ID's and assign the foundation "show-for" classes. then access it by ID in JS to see if it's active.. if it is you can trigger an event. Quote Link to comment Share on other sites More sharing options...
garywhitling Posted June 21, 2018 Author Share Posted June 21, 2018 Cheers Al and Noodleman, Found this that looks like it would do https://www.sitepoint.com/jquery-refresh-page-browser-resize/ ====================================================== //refresh page on browser resize $(window).bind('resize', function(e) { if (window.RT) clearTimeout(window.RT); window.RT = setTimeout(function() { this.location.reload(false); /* false to get page from cache */ }, 200); }); ================================================== However, not sure where to paste in Noodleman like your idea of using hidden div's to control the desktop layout only Quote Link to comment Share on other sites More sharing options...
Noodleman Posted June 21, 2018 Share Posted June 21, 2018 I've used that strategy a number of times as the earlier versions of foundation don't have many JS features Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.