Skip to content

Instantly share code, notes, and snippets.

View ivos's full-sized avatar

Ivo Maixner ivos

  • Praha, Czech rep.
View GitHub Profile
@ivos
ivos / fixNavbarIssue.js
Created November 11, 2012 18:31 — forked from claudiodangelis/fixNavbarIssue.js
[bootstrap] fixing issue #4153 `navbar-fixed-top`
function fixNavbarIssue(){
/* Quick & dirt draft fix for the bootstrap's navbar-fixed-top issue.
Overview
When you call a given section of a document (e.g. via <a href="#section"> or domain.com/page#section1) browsers show that section at the top of window. Bootstrap's navbar-fixed-top, _since it's fixed_, *overlays* first lines of content.
This function catches all of the <a> tags pointing to a section of the page and rewrites them to properly display content.
Works fine even if a # section is called from URL.
Usage