项目中有一个图片有预览(用的layer.photos()),需要异步修改图片地址,但是成功修改后第一次预览会显示修改前的大图,第二次以后就都正常了。

尝试修改成功后再次调用layer.photos(),也没有作用。

把layer.js文件中

loop || parent.on('click', options.img, function(){
       
      var othis = $(this), index = othis.attr('layer-index'); 
      layer.photos($.extend(options, {
        photos: {
          start: index,
          data: data,
          tab: options.tab
        },
        full: options.full
      }), true);
 pushData();
})

改为


loop || parent.on('click', options.img, function(){
pushData();
var othis = $(this), index = othis.attr('layer-index');
layer.photos($.extend(options, {
photos: {
start: index,
data: data,
tab: options.tab
},
full: options.full                                                                                  
}), true);

})

相关文章:

  • 2021-07-26
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2021-05-03
  • 2021-07-19
  • 2021-11-30
猜你喜欢
  • 2021-06-24
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-01-16
相关资源
相似解决方案