Created
April 21, 2016 12:53
-
-
Save beckettkev/32bb87623e0c69b8d5c2025ec709d1e9 to your computer and use it in GitHub Desktop.
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 addHeadLink(src, type, callback) { | |
var link = document.createElement(type === 'js' ? 'script' : 'link'); | |
link.setAttribute(type === 'js' ? 'src' : 'href', src); | |
link.setAttribute(type === 'js' ? 'type' : 'rel', type === 'js' ? 'text/javascript' : 'stylesheet'); | |
if (typeof callback !== 'undefined') { | |
link.onreadystatechange = function ( ) { | |
if (this.readyState == 'complete') { | |
callback(); | |
} | |
}; | |
link.onload = function ( ) { | |
callback(); | |
}; | |
} | |
document.getElementsByTagName('head')[0].appendChild(link); | |
} | |
function primeGoldfish() { | |
getAnimateCss(true); | |
Goldfish.Create(); | |
} | |
function getAnimateCss() { | |
addHeadLink('https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.1/animate.min.css', 'css'); | |
} | |
(function() { | |
var ua = window.navigator.userAgent; | |
if (ua.indexOf('MSIE ') > -1 || ua.indexOf('Trident/') > -1 || ua.indexOf('Edge/') > -1) { | |
//IE Pollyfill | |
addHeadLink('https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js', 'js', primeGoldfish); | |
} else { | |
//not in ie | |
primeGoldfish(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment