在缩略图库中显示图像

Displaying images in Thumbnail Image Gallery

本文关键字:显示 显示图 图像 略图      更新时间:2023-09-26

我正在尝试创建一个图像库: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

这是一个正在运行的演示。