jcanfield
7/9/2012 - 7:42 PM

CoffeeScript and JavaScript results to enhance Twitter Bootstrap navbar's "active" tab for multiple pages (essentially supplanting scrollspy

CoffeeScript and JavaScript results to enhance Twitter Bootstrap navbar's "active" tab for multiple pages (essentially supplanting scrollspy).

jQuery ->
  for link in $(".topbar .nav a")
    do (link) ->
      if (window.location.pathname == link.pathname)
        $(link).parent().toggleClass("active")
// Generated Output from CoffeeScript
jQuery(function() {
    var a, b, c, d, e;
    d = $(".topbar .nav a"), e = [];
    for (b = 0, c = d.length; b < c; b++)
        a = d[b], e.push(function(a) {
            if (window.location.pathname === a.pathname)
                return $(a).parent().toggleClass("active")
        }(a));
    return e
});