获取相等高度的列jQuery插件和Disqus以很好地播放 [英] Getting Equal Height Columns jQuery Plugin and Disqus to Play Nice

查看:125
本文介绍了获取相等高度的列jQuery插件和Disqus以很好地播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定将JS解决方案( EqualHeights插件)设置为等高列在这种情况下可能是最好的,但是我在使用Disqus时遇到了麻烦.您可能已经知道,Disqus异步加载.太好了,所有(嗯,不是真的),但是因为注释会在其他所有东西(包括插件)之后加载,所以它们被砍掉了.我不知道如何解决这个问题.我实际上尝试了CSS"hack"来获得相等高度的列,希望它不会与Disqus冲突,但是我也没有任何运气.

I decided that a JS solution (The EqualHeights Plugin) to equal height columns would probably be best in this case, but I'm having trouble with Disqus. As you probably already know, Disqus loads asynchronously. That's great and all (well, not really), but because the comments are loading after everything else, including the plugin, they're being chopped off. I can't figure out how to get around this. I actually tried a CSS "hack" to get equal height columns, hoping it wouldn't conflict with Disqus, but I didn't have any luck there either.

谢谢,伙计们.您在这里总是无价之宝.

Thanks in advance, guys. You're always invaluable here.

Disqus代码:

    <script type="text/javascript">var disqus_url = "{Permalink}"; var disqus_title ="{block:PostTitle}{PostTitle}{/block:PostTitle}";</script>{block:Permalink}<div id="disqus_thread"></div>
<script type="text/javascript">
  /**
    * var disqus_identifier; [Optional but recommended: Define a unique identifier (e.g. post id or slug) for this thread] 
    */
  (function() {
   var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
   dsq.src = 'http://escapology.disqus.com/embed.js';
   (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
</script>
<noscript>Please enable JavaScript to view <a href="http://disqus.com/?ref_noscript=escapology">comments.</a></noscript>
{/block:Permalink}<script type="text/javascript">
var disqus_shortname = 'escapology';
(function () {
  var s = document.createElement('script'); s.async = true;
  s.src = 'http://escapology.disqus.com/count.js';
  (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>

推荐答案

您可以将插件的执行推迟到Disqus加载之后.这是您为Disqus线程之一执行此操作的方法.对每个人都这样做:

You can defer the plugin execution until after disqus is loaded. Here's how you'd do it for one of your disqus threads. Do this for each one:

(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://escapology.disqus.com/embed.js';
var done=false;
dsq.onload=dsq.onreadystatechange = function(){
      if ( !done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete') ) {
        done=true;
        //CALL YOUR EQUAL HEIGHTS JQUERY CODE HERE
        dsq.onload = dsq.onreadystatechange = null;
      }
    };
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();

这篇关于获取相等高度的列jQuery插件和Disqus以很好地播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆