Revolution Slider jQuery版本(非WP版本)在运行时重新初始化 [英] Revolution Slider jQuery Version (Not WP Version) Re-initialization at runtime

查看:119
本文介绍了Revolution Slider jQuery版本(非WP版本)在运行时重新初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经在我们的页面中实现了革命滑块(jQuery版本,而不是WP).该页面必须长时间保持打开状态,并使用带有新内容或更新内容的Ajax以设置的时间间隔重新加载旋转滑块.

We have implemented the revolution slider (jQuery version, not WP) into a page of ours. This page must stay open for an extended period of time and reloads the revolution slider at set intervals using Ajax with new/updated content.

如何在运行时从DOM中完全删除滑块?我在初始化滑块的变量上使用了.remove(),但似乎滑块的某些事件/功能仍在运行.它按我们的计划工作,但是我觉得remove()函数不能完全从DOM中删除滑块,因为即使使用remove()函数删除了滑块并且没有再次对其进行初始化,偶尔也会出现控制台错误. .对这个问题的任何帮助/见解都会很棒!

How do we remove the slider completely from the DOM at runtime? I've used .remove() on the variable I initialized the slider with, but it appears that some of the events/functions of slider are still running. It works as we planned, but I feel that the remove() function doesn't completely remove the slider from the DOM because an occasional console error will pop up even after the slider has been removed with the remove() function and not reinitialized again. Any help/insight into the matter would be great!

感谢一堆!

推荐答案

我发现了解决Revolution Slider问题的解决方案.因此,此滑块和Ajax的问题​​是没有一种完全删除滑块及其所有计时器和事件的本地方法.因此,这会导致大量内存泄漏,并且在大约12个小时的过程中会累积1.5 gb的内存(在Mac上的Google Chrome中运行),并导致浏览器崩溃.

I've discovered a solution to the problem I had with the Revolution Slider. So, the issue with this slider and Ajax is the fact that there is no native way to fully remove the slider and all of it's timers and events. This therefore causes a massive memory leak and over the course of about 12 hours accumulates 1.5 gb of memory (running in Google Chrome on a Mac) and causes a crash of the browser.

解决方案:将滑块及其所有代码放置在iframe中.这允许在iframe中初始化滑块,并允许我们通过删除iframe,然后在新的iframe中重新加载新内容来将其从页面上完全删除.没有更多的内存泄漏,没有更多的问题.

The solution: Place the slider, along with all of it's code inside of an iframe. This allows the slider to be initialized inside of the iframe and allows for us to completely remove the slider from the page by removing the iframe and then reloading the slider with fresh content in a new iframe. No more memory leak, no more problems.

干杯!我希望这对外面的人有帮助.

Cheers! I hope this helps someone out there.

这篇关于Revolution Slider jQuery版本(非WP版本)在运行时重新初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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