javascript - Why jquery is not working in head -


i'm trying put code in <head> area because takes time load navigation menu in mobile devices. can see demo here: http://www.responsinator.com/?url=paison-templateify.blogspot.com.es%2f

i'm using tinynav.js convert navigation select dropdown, , i'm adding class in <ul> jquery here full code , placed in footer area , working, takes time load.

 $(document).ready(function() {     $('#menufy ul').addclass('zigla');      $(".zigla").tinynav();      });   (function(a, i, g) {      a.fn.tinynav = function(j) {          var b = a.extend({              active: "selected",              header: "",              label: ""          }, j);          return this.each(function() {              g;              var h = a(this),                  d = "tinynav"              g, f = ".l_"              d, e = a("<select/>").attr("id", d).addclass("tinynav "                  d);              if (h.is("ul,ol")) {                  "" !== b.header && e.append(a("<option/>").text(b.header));                  var c = "";                  h.addclass("l_"                      d).find("a").each(function() {                      c = '<option value="'                      a(this).attr("href")                      '">';                      var b;                      (b = 0; b < a(this).parents("ul, ol").length - 1; b) c = "- ";                      c = a(this).text()                      "</option>"                  });                  e.append(c);                  b.header || e.find(":eq("                      a(f " li").index(a(f " li."                          b.active))                      ")").attr("selected", !0);                  e.change(function() {                      i.location.href = a(this).val()                  });                  a(f).after(e);                  b.label && e.before(a("<label/>").attr("for", d).addclass("tinynav_label "                      d "_label").append(b.label))              }          })      }  })(jquery, this, 0); 

why code not working in <head> area?

you need move

$('#menufy ul').addclass('zigla'); 

inside

$(document).ready(function() {  }); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -