Created
April 12, 2012 19:23
-
-
Save bspingarn/2370313 to your computer and use it in GitHub Desktop.
Shorten each link text of a class name on pageload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shortenLink(){ | |
var screenWidth = $(window).width(); | |
var f = function(){ | |
var linkTextURL = $(this).text(); | |
if (screenWidth < 450) linkTextURL = linkTextURL.substring(0,40) + "..."; | |
$(this).text(linkTextURL); | |
} | |
$('a.resultLink').each(f); | |
} | |
$(function(){ //page load | |
shortenLink(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment