gpt4 book ai didi

javascript - 在缩略图库中显示图像

转载 作者:行者123 更新时间:2023-11-28 09:43:24 25 4
gpt4 key购买 nike

在这里,我尝试创建一个图片库:http://jsfiddle.net/5wETg/62/ .

var xml = "<rss version='2.0'><channel> <image>http://www.nikon.com/swf/img/thumbnail_ophthalmic_lenses.png</image> <image>http://www.nikon.com/swf/img/thumbnail_ophthalmic_lenses.png</image> <image>http://www.nikon.com/swf/img/thumbnail_ophthalmic_lenses.png</image> <limage>http://images1.videolan.org/images/largeVLC.png</limage> <limage>http://images1.videolan.org/images/largeVLC.png</limage> <limage>http://images1.videolan.org/images/largeVLC.png</limage>   </channel></rss>",

xmlDoc = $.parseXML( xml ),
$xml = $( xmlDoc ),
$image= $xml.find( "image" );
$limage = $xml.find("limage");

$( "#thumbs" ).append( $image.map(function(){
return $('<img>', {className: 'thumbnails', src:$(this).text()})[0];
})

$( "#panel" ).append( $image.map(function(){
return $('<img>', {className: 'largeimages', src:$(this).text()})[0];
})
);

我必须显示缩略图和较大图像,但存在图像未显示的问题。我需要一些帮助。

最佳答案

有几个问题:

  • 第一个 append() 未正确关闭(您错过了关闭));
  • 对于较大的图像,您使用的是 image 数组,而不是 limage

这是一个工作 DEMO

关于javascript - 在缩略图库中显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12106580/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com