Skip to content

Instantly share code, notes, and snippets.

@zrt
Forked from CaiJimmy/index.html
Created December 31, 2016 04:33
Show Gist options
  • Save zrt/212172807eadede0c95ba784caad6031 to your computer and use it in GitHub Desktop.
Save zrt/212172807eadede0c95ba784caad6031 to your computer and use it in GitHub Desktop.
Disqus点击加载
<button id="load-disqus" onclick="disqus.load();">
加载Disqus
</button>
<div id="disqus_thread"></div>
var disqus = {
load : function disqus(){
var disqus_shortname = 'disqus';
if(typeof DISQUS !== 'object') {
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
$('#load-disqus').remove(); ///加载后移除按钮
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment