简体   繁体   English

Slider Revolution + BarbaJS(PJAX)

[英]Slider Revolution + BarbaJS (PJAX)

I'm trying to get Slider Revolution sliders to reinitialize within BarbaJS. 我正在尝试让Slider Revolution滑块在BarbaJS中重新初始化。

I'm currently setting up functions originally notated by ThemePunch's documentation: 我目前正在设置最初由ThemePunch文档说明的功能:

// RevSlider
function getCurrentSliderAPI() {
    var slider = jQuery('.rev_slider');
    if(!slider.length) return false;
    return eval('revapi' + slider.attr('id').split('rev_slider_')[1].split('_')[0]);
}
// Start RevSlider
function startSlider() {
    var revapi = getCurrentSliderAPI();
    if(revapi) {
        revapi.revstart();
        console.log('Slider ' + revapi + ' started.');
    }
}
// Kill RevSlider
function killSlider() {
    var revapi = getCurrentSliderAPI();
    if(revapi) {
        revapi.revkill();
        console.log('Slider ' + revapi + ' killed.');
        revapi = null;
    }   
}

The getCurrentSliderAPI function seems to have issues. getCurrentSliderAPI函数似乎有问题。 I set console logs in order to make sure that function is actually working in the other two functions, to no avail. 我设置了控制台日志,以确保该功能实际上在其他两个功能中均有效,但无济于事。

With this current set up, I have this console error: revapi1 is not defined upon loading into the page from another with the slider activated. 在当前设置下,我出现了这个控制台错误:在激活了滑块的情况下,从另一个页面加载revapi1 is not defined

Any help in getting the Revolution Slider to initialize on page transitions would be very helpful. 任何使Revolution Slider在页面过渡上初始化的帮助都将非常有帮助。 Thanks. 谢谢。

https://stackoverflow.com/a/25191095/4220832 https://stackoverflow.com/a/25191095/4220832

This looks to be the answer to the issue I need, even though it's about the jQuery version. 这似乎是我需要的问题的答案,即使它与jQuery版本有关。 I would have to place the slider inside of an iframe in order to get it to reinitialize, since it removes the iframe and reloads it in a new one. 我必须将滑块放置在iframe中才能重新初始化,因为它会删除iframe并将其重新加载到新的iframe中。 This isn't ideal to use iframes, but it reduces the memory leak issue as well. 这对于使用iframe来说并不理想,但它也可以减少内存泄漏问题。

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

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