nodirtyrockstar Posted December 3, 2012 Share Posted December 3, 2012 (edited) Generally speaking, I have a love/hate relationship with Javascript. That said, I am trying to clean up my website for a new job and would like to demonstrate that I can use JS without giving up functionality. I have a page that demonstrates the websites in my portfolio. There are submenus under the main navigation. When you are on the webs page, switching between submenu items is done with Javascript. I would like to make that content available to users with JS disabled. I had the bright idea to stick it inside the <noscript> tags, but that stretches out my page container with invisible content even if you are using JS. Has anyone gone through this before? Does anyone have any thoughts about how to make this content available for JS disabled users without removing the Javascript? Thanks in advance! Edited December 3, 2012 by nodirtyrockstar Quote Link to comment https://forums.phpfreaks.com/topic/271538-demonstrate-javascript-without-losing-functionality-yes-its-about-php/ Share on other sites More sharing options...
Muddy_Funster Posted December 3, 2012 Share Posted December 3, 2012 You could create an alternate page set and link to it within the noscript tags with something like "It seems you do not have Javascript enabled in your browser - please click here to view the javascript free version of my work" then copy paste and tweek to suit. Quote Link to comment https://forums.phpfreaks.com/topic/271538-demonstrate-javascript-without-losing-functionality-yes-its-about-php/#findComment-1397206 Share on other sites More sharing options...
JonnoTheDev Posted December 3, 2012 Share Posted December 3, 2012 (edited) You could create an alternate page set and link to it within the noscript tags with something like "It seems you do not have Javascript enabled in your browser - please click here to view the javascript free version of my work" then copy paste and tweek to suit. That isn't going to help with the page layout. When using Javascript you should always first make the page function and display properly without any JS code. Once this is done the Javascript can then be added to manipulate the DOM elements. For instance, if I have a navigation bar with a link on that I want to open a sub menu when a user moves their mouse over it, I would make the sub menu hidden to the user using CSS (display:none;). If Javascript is disabled then they can only click on the link in the navigation that will take them to a page containing further links that would normally have been displayed in the sub menu. With Javascript enabled the sub menu is displayed using the onmouseover action. Edited December 3, 2012 by neil.johnson Quote Link to comment https://forums.phpfreaks.com/topic/271538-demonstrate-javascript-without-losing-functionality-yes-its-about-php/#findComment-1397218 Share on other sites More sharing options...
nodirtyrockstar Posted December 3, 2012 Author Share Posted December 3, 2012 @Muddy Funster, I think you're right. The functionality is already there to do it without JS (load the pages with a $_GET request). I'll just drop the links in the <noscript> area. Since there aren't many, it won't look suspicious to have a little gap before the footer. Quote Link to comment https://forums.phpfreaks.com/topic/271538-demonstrate-javascript-without-losing-functionality-yes-its-about-php/#findComment-1397233 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.