Created
October 24, 2013 07:19
-
-
Save thomasmb/7132686 to your computer and use it in GitHub Desktop.
A JS function used to add a stylesheet to the HTML head tag, but only once ( in this cases it uses jQuery )
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 add_stylesheet_once( url ){ | |
$head = $('head'); | |
if( $head.find('link[rel="stylesheet"][href="'+url+'"]').length < 1 ) | |
$head.append('<link rel="stylesheet" href="'+ url +'" type="text/css" />'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment