开发者

How to re-load a jQuery plugin on page resize?

开发者 https://www.devze.com 2023-01-04 20:02 出处:网络
I\'m开发者_运维知识库 using the Galleria plugin in an AP div that is elastic. Galleria centers and crops itself nicely on page load but doesn\'t handle resizing so gracefully. If I resize and then rel

I'm开发者_运维知识库 using the Galleria plugin in an AP div that is elastic. Galleria centers and crops itself nicely on page load but doesn't handle resizing so gracefully. If I resize and then reload the page, it looks great, so I'm wondering if there is a way to unload/reload the plugin ONLY on resize?


if the galleria plugin has a destroy method, use that. but if not, maybe you could try clearing the HTML to it's state before the plugin was originally loaded: effectively resetting the galleria's parent element to empty. maybe use something like

$(window).resize(
    $('#galleria-parent-element').html('');
    //reload galleria plugin to fresh state
);


Handle the resize event.

0

精彩评论

暂无评论...
验证码 换一张
取 消