Follow button rendering issues


#1

I’m using the follow button on the contacts section of my webpage. When you first load it it works just fine, but on subsequent “loads” it doesn’t pull the graphics. What I’m doing is running a single div that loads content and then .empty()s before loading new content. When you navigate back to the contacts section the script to call the graphics has already run when it loaded originally so it doesn’t call it again and I get stuck with just text. Is there a simple solution to this problem or do I need to use a different method to link to my Twitter?

Here’s a glimpse of the code I’m using.

var fade1 = function(fader,group){
		if (fader.hasClass("inTop")){
			//do nothing
		} else {
			$(".inTop").removeClass("inTop").fadeOut(1000);
			$(".inRight").removeClass("inRight").fadeOut(1000);
			$("#left").empty().fadeIn(0);
			fader.addClass("inTop").fadeIn(1000);
			$("#left").prepend("<h1>"+group+"</h1>");
		}
	};

fade1( $("#contact"), "Contact</h1><a href='https://twitter.com/patheticliform' class='twitter-follow-button' data-show-count='false' data-size='large' data-dnt='true'>Follow @patheticliform</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='//platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','twitter-wjs');</script>");
<code/>

#2