Follow Me

Disqus Comment Update with Onclick Event

Disqus Comment Update with Onclick Event
For those who have already done the tips on how to Loading Disqus Comments with the Onclick Event in my past posts and those tips do not work on your blog template, here I will provide improvements or updates so that these tips can function properly.

For an explanation of how the Disqus Comment button works with the Onclick Event, you can check this link. Well, here are the steps.

Disqus Comment Update with Onclick Event

Open Blogger> Click the Theme menu> Then click the Edit HTML button and add this code just below the HTML code <b:includable id='comments'var='post'> ... </b:includable>


<b:includable id='disqus-comment' var='post'>
<script type='text/javascript'>
var disqus_blogger_current_url = &quot;<data:blog.canonicalUrl/>&quot;;
if (!disqus_blogger_current_url.length) {
disqus_blogger_current_url = &quot;<data:blog.url/>&quot;;
}
var disqus_blogger_homepage_url = &quot;<data:blog.homepageUrl/>&quot;;
var disqus_blogger_canonical_homepage_url = &quot;<data:blog.canonicalHomepageUrl/>&quot;;
</script>
</b:includable>

After that add this code right under the code <b:includable id ='comments'var ='post'>


<div id='disqusshow' onclick='load_Comments()'><i class='fa fa-comments'/> Load comments</div>
<div id='disqus_thread'/>

Then the result will be like this

<b:includable id='comments' var='post'>
<div id='disqusshow' onclick='load_Comments()'><i class='fa fa-comments'/> Load comments</div>
<div id='disqus_thread'/>


Then add this CSS code before </head>


<b:if cond='data:blog.pageType != &quot;index&quot;'>
<style type='text/css'>
/* Onclick Disqus Comment */
#comments{display:none}
.post-comment-link{visibility:hidden}
#disqus_thread{background:#fff;margin:10px 0 0 0;padding:0}
#disqusshow{position:relative;overflow:hidden;display:block;text-align:left;font-weight:700;font-size:18px;cursor:pointer;letter-spacing:0;line-height:20px;margin:10px auto;padding:10px;background:#00b894;color:#fff;transition:all .3s}
#disqusshow:hover,#disqusshow:active{color:#fff}
</style>
</b:if>

Arrange CSS according to your wishes
Then add the code below before </body> or &lt;!-</body>-&gt;&lt;/body&gt; and change the code marked wiendhy with the username disqus your blog.

<b:if cond='data:blog.pageType != &quot;index&quot;'>
<script type='text/javascript'>
var disqus_shortname = &quot;wiendhy&quot;;
!function(){var e=document.createElement(&quot;script&quot;);e.type=&quot;text/javascript&quot;,e.async=!0,e.src=&quot;//&quot;+disqus_shortname+&quot;.disqus.com/blogger_index.js&quot;,(document.getElementsByTagName(&quot;head&quot;)[0]||document.getElementsByTagName(&quot;body&quot;)[0]).appendChild(e)}();
</script>
<script type='text/javascript'>
!function(){var e=document.createElement(&quot;script&quot;);e.type=&quot;text/javascript&quot;,e.async=!0,e.src=&quot;//&quot;+disqus_shortname+&quot;.disqus.com/blogger_item.js&quot;,(document.getElementsByTagName(&quot;head&quot;)[0]||document.getElementsByTagName(&quot;body&quot;)[0]).appendChild(e)}();
//<![CDATA[
function load_Comments(){var e=document.getElementById("disqusshow");e.style.display="none";var t="arlinadesign";!function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://"+t+".disqus.com/embed.js",(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(e)}()}
//]]>
</script>
</b:if>
Finish and see the results on your blog.

Additional

For those who activate the Google+ comment system on their blog, please deactivate it first so that the above code can work properly and set blog comment settings in Settings> Posts, comments, and sharing> Comments> Then adjust it to be like the picture below
Bonus

For those who yesterday, how to add gradient colors like in the menu above this blog, please add this CSS and change the .class-option with the class or CSS ID of your blog as you wish. The point is that the marked code can add friends in any class or ID in the template.


@keyframes Gradient{0%{background-position:0 50%}50%{background-position:100% 50%}100%{background-position:0 50%}}

.class-pilihan{background:#f24a4a;background:linear-gradient(-50deg,#ee5952,#ea3a7e,#20aadb,#23e0b3);background-size:320% 200%;animation:Gradient 15s ease infinite}

That's the Update on Disqus Comments with the Onclick Event, hopefully useful and cautious.

Next Post Previous Post
No Comment
Add Comment
comment url