August 14, 201213 yr Coding a website up that is Js heavy(used for animations of content boxes), and i was wondering if there is a way to in the case if someone has JS disabled, gracefully degradation will kick in and make the site appear to the user just without the whiz bang and pop. Two solutions i have come up with so far are to, rebuild the mark-up and CSS as it would appear without JS Then add JS to make it have all the fancy stuff Second method Have an id or class on the body element by default and use this as a base to style a no JS version and if JS is enabled, remove or change this ID to show the JS script you can run. Just wondering if anyone else has come across this problem before and how they have tackled it. Thanks in advanced! Ben
August 14, 201213 yr A pretty common tactic that's around these days is the change the class on the <html> element: <!-- In your HTML --> <html class="no-js"> // In your Javascript document.documentElement.className = 'js'; Now any rule that starts with .no-js won't be seen if the user has Javascript enabled
August 16, 201213 yr Two words; Progressive enhancement Javascript should be used to enhance the user experience, with very few exceptions, if your site is broken without it then you aren't doing it right. Sorry if this sounds a bit hardline, but method 1 is the only sensible approach. p.s. You know you can animate stuff with css too right?
Create an account or sign in to comment