使用jquery版本的viewer.js图片更新的问题

来源:互联网 发布:淘宝助理 电子面单 编辑:程序博客网 时间:2024/06/16 12:59

问题:使用jquery版本的viewer.js时,点击查询之后加载新的图片,但是使用viewer.js查看大图的时候发现还是原来的图片,没有更新图片。


HTML

<ul id="mypicture" class="docs-pictures clearfix" style="background-color:#f8f8f8;min-height:200px"></ul>


清空原来的ul之后,把新生成li放进去之后,察看图片时,点击大图的时候图片没有更新

$("#mypicture").html("");$("#mypicture").html(imagesStr); var options = {     url: 'data-original',     };$("#mypicture").viewer(options);



察看viewer.js的文档发现在每次查询更新ul之后需要update一下

update()

Update the viewer when images changed.

If you load images dynamically, you can use this method to add the new images to the viewer instance.

$("#mypicture").viewer('update');
在改变加载图片之后加上这一句




原创粉丝点击