相关疑难解决方法(0)

JavaScript/JQuery:$(window).resize如何在调整大小完成后触发?

我正在使用JQuery:

$(window).resize(function() { ... });
Run Code Online (Sandbox Code Playgroud)

但是,似乎如果此人通过拖动窗口边缘来手动调整其浏览器窗口的大小以使其变大或变小,则.resize上述事件将多次触发.

问题:如何在浏览器窗口调整大小完成后调用函数(以便事件仅触发一次)?

javascript jquery

228
推荐指数
9
解决办法
23万
查看次数

调整galleria的脚本

我想调整整个galleria div的大小,并调整使用galleria脚本动态生成的所有图像.

到目前为止我有

    $(window).resize(function() {
    var h = $(window).height();
    var galleriaHeight = h-54;
    var w = $(".content").width();
    var galleriaWidth = w-18;

    $("#galleria").height(galleriaHeight);
    $("#galleria").width(w);


    $(".galleria-stage").height(galleriaHeight);
    $(".galleria-stage").width(galleriaWidth);

    $(".galleria-images .galleria-image img").css({"max-height":"auto"});
    $(".galleria-images .galleria-image img").css({"max-width":galleriaWidth-36});

    $(".galleria-stage").height(galleriaHeight);
    $(".galleria-stage").width(galleriaWidth);

    $(".galleria-container").width(w);
    $(".galleria-container").height(galleriaHeight);

    $(".caption").width(w);
    $(".counter-nav").width(w);

    var sidebarHeight =h-54;
    var contentHeight =h-36;

    $(".sidebar1").height(sidebarHeight);
    $(".content").height(contentHeight);




});
Run Code Online (Sandbox Code Playgroud)

但是一切都在不均衡地扩展并且非常混乱.看完全屏代码后,我还补充道

this.bind(Galleria.RESCALE, function() {
 POS = this.getStageHeight() - tab.height() - 2;
 thumbs.css('top', OPEN ? POS - list.outerHeight() + 2 : POS);
 var img = this.getActiveImage();
 if (img) 
     {
     fixCaption(img);
     }
});
Run Code Online (Sandbox Code Playgroud)

但这也不起作用......

我想我想在我调整大小后重新加载页面...或者相对于彼此调整所有元素的大小,或者使用Galleria调整大小脚本......

有任何想法吗?

jquery galleria

2
推荐指数
1
解决办法
9341
查看次数

标签 统计

jquery ×2

galleria ×1

javascript ×1