user3388031
user3388031

Reputation:

modernizr no-js class does not work

Let this be my first experience here on stackoverflow and my very first question. Recently I went from old skool HTML to HTML5, so after some research I learned about Modernizr.

I made my Head up like this :

<!DOCTYPE html>

<!--[if IE 6]>
<html class="no-js" id="ie ie6" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 7]>
<html class="no-js" id="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html  class="no-js"id="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!-->
<html class="no-js" <?php language_attributes(); ?>>
<!--<![endif]-->

<head>

<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/> 

<script src="<?php bloginfo('template_directory'); ?>/js/modernizr.custom.65696.js"></script>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://code.jquery.com/jquery-2.1.0.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script>

</head>

After checking source in my browser I see that the no-js class is not changed to js. Clicked on the js link in the source and I do get the code of the modernizr, so there is no broken link.

Can anyone tell me what I did wrong.

Thanks in advance.

Upvotes: 1

Views: 1307

Answers (1)

Patrick
Patrick

Reputation: 13984

I replied to your question over at the wordpress forums, but here is the same answer

Modernizr is client side javascript, and so it runs after the source code is loaded into the browser. It doesn't actually modify the source, it modifies the DOM

If you open up your developer tools in the browser, you will see that the html classes are removed.

hope that helps!

Upvotes: 1

Related Questions