【问题标题】:Displaying images in Thumbnail Image Gallery在缩略图图库中显示图像
【发布时间】:2012-08-24 09:25:08
【问题描述】:

我正在尝试创建一个图片库: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];
    })
);

我必须同时显示缩略图和较大的图像,但是图像无法显示的问题。我需要一些帮助。

【问题讨论】:

  • there is problem in showing the images 什么意思?图片不显示?
  • @blasteralfred:图片没有显示出来。

标签: javascript jquery xml xml-parsing


【解决方案1】:

有几个问题:

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

这是一个有效的DEMO

【讨论】:

  • 谢谢,我明白我忘了使用 limage。小问题。非常感谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-09-13
  • 1970-01-01
  • 2014-08-05
  • 2011-05-05
  • 2012-04-18
  • 2016-06-13
  • 1970-01-01
相关资源
最近更新 更多