Skip to content

Instantly share code, notes, and snippets.

@aahan
Last active December 30, 2015 12:09
Show Gist options
  • Save aahan/7827514 to your computer and use it in GitHub Desktop.
Save aahan/7827514 to your computer and use it in GitHub Desktop.
Lazy loading Disqus comments (i.e. loading on scroll) can be done with these JavaScript plugins.

And probably even with:

Related:

x. Display Disqus On Click Event (also check out how the site does it from the source)

$j=jQuery.noConflict();

$j(document).ready(function() {
	$j('.showComments').on('click', function(){
		$j('#displayComments').fadeIn();
		var disqus_shortname = 'paulund';

		$j.ajax({
	         type: "GET",
	         url: "http://" + disqus_shortname + ".disqus.com/embed.js",
	         dataType: "script",
	         cache: true
	     });

		$j.ajax({
	         type: "GET",
	         url: "https://apis.google.com/js/plusone.js",
	         dataType: "script",
	         cache: true
	     });

		$j.ajax({
	         type: "GET",
	         url: "http://platform.twitter.com/widgets.js",
	         dataType: "script",
	         cache: true
	     });

		$j(this).fadeOut();
	});
});

x. Lazy Load Social Media Buttons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment