简体   繁体   English

ajax后Zurb基础均衡器调整大小

[英]Zurb foundation equalizer resize after ajax

I ran into a problem with Foundation equalizer, I am trying to dynamically readjust div heights with equalizer after I change content with ajax. 我遇到了Foundation均衡器的问题,我尝试在用ajax更改内容后动态重新调整带有均衡器的div高度。 I searched Foundation documentation, Stack overflow but I found no answer to this problem. 我搜索了基础文档,堆栈溢出,但没有找到此问题的答案。

I noticed that it readjusts when I resize the browser, so it is possible, I just want to find out how to trigger it. 我注意到在调整浏览器大小时它会重新调整,所以有可能,我只想了解如何触发它。 (I obviously don't want to tell visitors to resize the browser every time they click a link) (我显然不想告诉访问者每次单击链接时都要调整浏览器的大小)

edit: This seems to work, but is that the best solution? 编辑:这似乎可行,但这是最好的解决方案吗?

$("#media").click(function(){
        $.ajax({
        url: "mediaproduction.html"
        })
        .done(function( html ) {
            $( "#main-content" ).html( html );

            $(document).foundation();
        });
    });

For Foundation 6 : 对于Foundation 6:

Foundation.reInit('equalizer');

More info in the doc : http://foundation.zurb.com/sites/docs/javascript.html#adding-plugins-after-page-load 该文档中的更多信息: http : //foundation.zurb.com/sites/docs/javascript.html#adding-plugins-after-page-load

这是我们在网站上使用的用于执行您正在谈论的事情:

$(document).foundation('equalizer','reflow');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM