繁体   English   中英

在缩略图库中显示图像

[英]Displaying images in Thumbnail Image Gallery

在这里,我试图创建一个图像库: 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

暂无
暂无

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

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