Sunday, 17 January 2016

How to load disqus when scroll to the bottom of the page?

How to load disqus when scroll to the bottom of the page?

Question: What is Disqus?
It is comment hosting service for web sites and online communities. It provide Services so that you can add comment system in your website.


Question: is Disqus multilingual?
Yes, It is.


Question: When Disqus was Launched?
October 2007


Question: Can we embed disqus in website?
Yes, you can embed.


Question: Does it provides channel for discussion?
Yes, It provides channel to discuss.


Question: What is offical website of Disqus?
http://disqus.com


Question: Can facebook user post comment using their fb account?
Yes, Facebook, twitter and google user can post comment using their account


Question: How to load disqus when scroll to the bottom of the page?
                        
  /*  CONFIGURATION VARIABLES  - MUST SET */
  var disqus_developer = 0;
  var disqus_shortname = 'aboutcity'; // required: replace example with your forum shortname                            
  var disqus_identifier = '/2015/07/ajax-technical-interview-questions-and-answers-for-experienced.html';
  var disqus_url = 'http://www.web-technology-experts-notes.in/2015/07/ajax-technical-interview-questions-and-answers-for-experienced.html';                    
  /*  CONFIGURATION VARIABLES  - MUST SET */
  
  var disqus_loaded = false;

  function load_disqus(){     
    disqus_loaded = true;
    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
    dsq.src = "http://"+disqus_shortname+".disqus.com/embed.js";       
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);

  }

/** check now bottom of page **/
  window.onscroll = function(e) {
   if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
    //hit bottom of page
    if (disqus_loaded==false){ load_disqus() };
   }
  };