Drupal adds class js to html tag when JavaScript is enabled
texas-bronius: What's the best way to provide css for non-js-enabled browsers that differs for css for js-enabled?
17:13 texas-bronius: hi benjamin-agaric welcome back
17:15 benjamin-agaric: texas-bronius: hi. Assign the classes themselves with JavaScript?
17:15 texas-bronius: benjamin-agaric: duh. Yes, good idea thanks. Class name could be "hasjs" or something.
17:17 texas-bronius: benjamin-agaric and anyone else listening in: Looks like Drupal already does provide a class="js" on the root html node-- it eluded me earlier because it doesn't show in source, only post-javascript! :D woo hoo
Update: There's also a js-hide class which will hide anything that has that class when JavaScript is enabled.
benjamin-agaric: texas-bronius: mind if this self-discovery gets posted to data.agaric.com?
texas-bronius: benjamin-agaric: not sure what you mean? ..
benjamin-agaric: texas-bronius: i post every piece of useful information i come across -- usually it's something i had trouble with, but sometimes its something i see come across irc -- because i know i'll be needing it later
texas-bronius: benjamin-agaric: If you want to blog "Drupal adds class js to html tag" heck yeah go ahead-- wish you'd done it earlier! :D
benjamin-agaric: and it's useful to some other people do
benjamin-agaric: texas-bronius: exactly!
texas-bronius: but cite:
texas-bronius: http://www.lullabot.com/articles/bitchin-search-box
texas-bronius: where I first thought ot learn about this-- it only just occurred to me now why I was unable to see it 'til now :D
Comments
Post new comment