0
我为我的背景幻灯片使用了真棒插件jQuery BackStretch。这是如何将图像传递给它的常用方法。从HTML动态提供幻灯片图片(jQuery地图/获取)
$.backstretch([
"http://dl.dropbox.com/u/515046/www/outside.jpg",
"http://dl.dropbox.com/u/515046/www/garfield-interior.jpg",
"http://dl.dropbox.com/u/515046/www/cheers.jpg"
], {duration: 3000, fade: 750});
我不想通过硬编码为它提供图像,但我希望函数能够抓住我的PHP在该容器内生成的内容。这是迄今为止我所拥有的。
var images = $('#background img').map(function() { return this.src; }).get();
$.backstretch([$images], {duration: 3000, fade: 750});
而且,很显然,不能正常工作 - 根据萤火,可变图像没有定义(?)。虽然如果我“提醒”这个变量,它会显示逗号分隔的图像。
任何想法我做错了什么?谢谢!
什么php的样子 – 2013-03-10 07:18:34
还是你想用'从'images'右侧列表backstretch' ?假设这是'#background img'选择器。 – 2013-03-10 07:19:39