Skip to content

Commit

Permalink
Merge pull request #11 from su/retainLink
Browse files Browse the repository at this point in the history
Retain the first link encountered in target text.
  • Loading branch information
freqdec committed Jul 3, 2012
2 parents 109c79e + 77a8547 commit 34f8003
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/jquery.slabtext.js
Expand Up @@ -42,6 +42,8 @@
viewportBreakpoint = settings.viewportBreakpoint,
resizeThrottle = null,
viewportWidth = $(window).width();
// Extract the first href from source text
hedLink = $this.find("a:first").attr("href");

// Calculates the pixel equivalent of 1em within the current header
var grabPixelFontSize = function() {
Expand Down Expand Up @@ -129,6 +131,10 @@
};

$this.html(lineText.join(" "));
// If we have a hedLink, add it back just inside our target, around all the slabText spans
if (hedLink) {
$this.wrapInner('<a href="' + hedLink + '" />');
}
};
} else {
// We only need the font-size for the resize-to-fit functionality
Expand Down

0 comments on commit 34f8003

Please sign in to comment.