2016-05-31 10 views
0

Hier ist meine codepen:JQuery-Code funktioniert nur auf Firefox?

http://codepen.io/anon/pen/gMbaMW

<!DOCTYPE html> 
<html> 
<head> 
<title>About me</title> 

<link rel="stylesheet" type="text/css" href="css/aboutme.css"> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
<script src="https://raw.githubusercontent.com/mattboldt/typed.js/master/js/typed.js"></script> 


<script> 

    $(function(){ 
     $("#typed").typed({ 
      strings: ["Jack.", "a Programmer.","a Gamer.","an Enthusiast who has a passion for Knowledge, Experiences, Challenges and Food."], 
     typeSpeed: 20, 
      loop: false, 
      // defaults to false for infinite loop 
      callback: function(){ foo(); } 
     }); 


     function foo(){ console.log("Callback"); } 
    }); 

</script> 

</head> 

<header> 
<p>So, who am I?</p> 
</header> 
<body> 
<div class ="mtext"> 
<h1 id="pretyped"> I am <h1 id="typed"></h1></h1> 

<br> 
</div> 

</body> 
</html> 

die Sache ist, funktioniert dies nur auf meinem Standard-Browser, das heißt. firefox, es funktioniert einfach nicht auf etwas anderes. Irgendeine Hilfe?

Antwort

0

Ich glaube, es liegt daran, dass Sie die typed.js-Bibliothek über GitHub laden, die nicht den richtigen MIME-Typ hat. Ich würde empfehlen, etwas wie RawGit zu verwenden, um die Bibliothek zu bedienen, oder einfach herunterladen und lokal laden.

Mit RawGit würde die URL etwa wie https://rawgit.com/mattboldt/typed.js/master/js/typed.js für die Entwicklung und https://cdn.rawgit.com/mattboldt/typed.js/master/js/typed.js für die Produktion aussehen.

Ich habe eine JSFiddle erstellt, die Sie auf here verweisen können.

+0

omfg, vielen Dank der Rawgit Link behoben. du bist der Beste <3 –

Verwandte Themen