Zurb foundation equalizer resize after ajax

空扰寡人 提交于 2019-12-13 04:47:43

问题


I ran into a problem with Foundation equalizer, I am trying to dynamically readjust div heights with equalizer after I change content with ajax. 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();
        });
    });

回答1:


For Foundation 6 :

Foundation.reInit('equalizer');

More info in the doc : http://foundation.zurb.com/sites/docs/javascript.html#adding-plugins-after-page-load




回答2:


This is what we use on our site to do what you are talking about:

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


来源:https://stackoverflow.com/questions/27021811/zurb-foundation-equalizer-resize-after-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!