Skip to content

Instantly share code, notes, and snippets.

View timwasson's full-sized avatar

Tim Wasson timwasson

View GitHub Profile
@timwasson
timwasson / Sticky top menu with active links.
Last active December 14, 2015 15:48
The world's easiest sticky top-menu with links that highlight. Just give your nav a class of "topmenu", and your individual sections a class of "section", and link to the ID of the element you want to scroll to.
@timwasson
timwasson / Twitter Bootstrap dynamic image modal
Created February 22, 2013 21:08
For users of the fantastic Twitter Bootstrap, this will dynamically create a modal dialog for an image when you've got an <a> with the class of "modal-dialog". The image should have a data-attribute of "data-full-size". The image's alt attribute is used for the modal title. This is quick and dirty, but hopefully useable.
//Sample HTML to use
<a class="modal-dialog"><img src="thumb.png" alt="Image Title" data-full-size="full-size.png"></a>
// Look for modal pop-ups
var modalPops = $("a.modal-dialog");
//If there's modals, inject all the necessary code.
if(modalPops.length) {
//First add the data attributes