fotorama滑块:通过ajax更新图像后slier不工作

fotorama滑块:通过ajax更新图像后slier不工作,ajax,slider,fotorama,Ajax,Slider,Fotorama,这从一开始就很管用。一旦我通过ajax调用更新了图像,Slider就不起作用了。。请帮助。这是一种更新fotorama中图像的糟糕方法。您仍然可以通过更改onreadystatechange函数使其工作: <script src="includes/fotorama.js"></script> <div id="fotorama" class="fotorama"> <img src="images/6.jpg"/> <img

这从一开始就很管用。一旦我通过ajax调用更新了图像,Slider就不起作用了。。请帮助。

这是一种更新fotorama中图像的糟糕方法。您仍然可以通过更改
onreadystatechange
函数使其工作:

   <script src="includes/fotorama.js"></script>
   <div id="fotorama" class="fotorama"> 
<img  src="images/6.jpg"/>
<img  src="images/7.jpg"/>
<img  src="images/8.jpg"/>
  </div>

图像对象可能如下所示:

// Get access to the API
var fotorama = $('#gallery-id').data('fotorama');

// Overwirte all the photos
fotorama.load([
  {img: '1.jpg', thumb: '1-thumb.jpg'},
  {img: '2.jpg', thumb: '2-thumb.jpg'},
  {img: '3.jpg', thumb: '3-thumb.jpg'}
]);

// Or push one to the end
fotorama.push({img: '4.jpg', thumb: '4-thumb.jpg'});
function-fun(str){var-xmlhttp;if(window.XMLHttpRequest){//IE7+、Firefox、Chrome、Opera、Safari-xmlhttp=new-XMLHttpRequest();}else{//IE6、IE5-xmlhttp=new-ActiveXObject(“Microsoft.xmlhttp”);}xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.getElementById(“fotorama”).innerHTML=xmlhttp.responseText;}}xmlhttp.open(“GET”,“home/s?regid=“+str,true”);xmlhttp.send();}
// Get access to the API
var fotorama = $('#gallery-id').data('fotorama');

// Overwirte all the photos
fotorama.load([
  {img: '1.jpg', thumb: '1-thumb.jpg'},
  {img: '2.jpg', thumb: '2-thumb.jpg'},
  {img: '3.jpg', thumb: '3-thumb.jpg'}
]);

// Or push one to the end
fotorama.push({img: '4.jpg', thumb: '4-thumb.jpg'});
{
  img: '1.jpg',
  thumb: '1-thumb.jpg', // if you are using the `nav:'thumbs'` option
  full: '1-full.jpg', // separate image for the fullscreen mode
  id: 'one', // custom anchor, used with the `hash:true` option
  fit: 'cover', // override the global fit option
  caption: 'The first one'
}