简体   繁体   English

带有.load()的jQuery幻灯片插件

[英]jQuery slideshow plugin with .load()

I'm trying to make an auto slideshow with pics from other .php file and to achieve that i've decided i will use http://responsiveslides.com/ jQuery plugin. 我正在尝试使用其他.php文件中的图片制作自动幻灯片放映,并实现这一目标,我决定我将使用http://sensitiveslides.com/ jQuery插件。 The problem is that this plugin doesn't want to work with my photos by "loading" them from other file. 问题是该插件不想通过从其他文件“加载”它们来处理我的照片。

$('.first-option').click(function(){
    $('.inner-box').load('file.php .rslides');
});
$(function() {
    $("file.php .rslides").responsiveSlides();
});

*CSS/HTML are exactly the same way written like the author wrote in his "Usage". * CSS / HTML的编写方式与作者在其“用法”中编写的方式完全相同。

try this: 尝试这个:

$('.first-option').click(function(){
    $('.inner-box').load('file.php .rslides', function callback () {
        $('.rslides').responsiveSlides();
    });
});

I've not used the plugin before, but it appears that you need to apply the bootstrap method to the element that contains the slides you load into your page. 我以前没有使用过该插件,但是看来您需要将bootstrap方法应用于包含要加载到页面中的幻灯片的元素。 So what you're doing in your code is attaching the load method to the click handler, while attaching the responsive slides to an empty selector when the DOM is ready. 因此,您在代码中所做的就是将load方法附加到单击处理程序,而在DOM准备就绪时将响应幻灯片附加到一个空选择器。 What I've provided above loads the content, and then using a callback function (when the content has successfully been loaded into the DOM), then calls the bootstrap method onto the original selector. 我上面提供的内容将加载内容,然后使用回调函数(当内容已成功加载到DOM中时),然后将bootstrap方法调用到原始选择器上。

Edited the code to use the '.rslides' selector. 编辑代码以使用“ .rslides”选择器。

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

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