Permalink
Browse files

Merge pull request #11 from su/retainLink

Retain the first link encountered in target text.
  • Loading branch information...
freqdec committed Jul 3, 2012
2 parents 109c79e + 77a8547 commit 34f80036c5d76908b28ff093bb5dc90dc08ef53b
Showing with 6 additions and 0 deletions.
  1. +6 −0 js/jquery.slabtext.js
View
@@ -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() {
@@ -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

0 comments on commit 34f8003

Please sign in to comment.