fotorama如何使用ajax [英] fotorama how to work with ajax

查看:113
本文介绍了fotorama如何使用ajax的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在fotorama中使用Ajax遇到了两个问题

I got two problems by using ajax in fotorama

i)在ajax之前,我的代码是:

i) before ajax, my code is:

<div id="AjaxPhoto" class="fotorama" data-nav="thumbs" data-ratio="4/3"></div>

ajax之后,我的代码是:

after ajax, my code is:

<div id="AjaxPhoto" class="fotorama" data-nav="thumbs" data-ratio="4/3">
  <img src="1.jpg" />
  <img src="2.jpg" />
</div>

在这种情况下,fotorama可能起作用或不起作用

the fotorama may work or not work in this case

ii)假设当我通过以下方式清除数据时,fotorama工作成功"了

ii) assume the fotorama works 'successfully', when I clear data by

$("#AjaxPhoto").empty();
$(".fotorama--hidden").remove();

,然后添加其他图像,则fotorama完全无法正常工作. fotorama是否支持Ajax?

and then add the other images, the fotorama is exactly not work again. Does fotorama support ajax?

推荐答案

清除照片时&重新添加您需要重新初始化插件以使其正常工作所需的照片.

When you clear the photos & re-add the photos you need to re-initalize the plugin again for it to work.

$("#AjaxPhoto").empty();
$(".fotorama--hidden").remove();
// Load the new set of Photos here
// after that the below statement will re-initialize the fotorama gallery plugin
$('.fotorama').fotorama();

这篇关于fotorama如何使用ajax的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆