我正在尝试使用jquery在我的prestashop产品页面中加载动态图像。
是否可以在jquery文件中使用src加载<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">[{"RequestID":1052,"IMNumber":"dsdsad","CMNumber":"","RequirementsReceivedDate":"2017-04-20T15:04:02.423","PlannedImplementationDate":"2017-04-20T15:04:02.423","DevAssigned":"name","Title":"dsadsada","Description":"dsadsadsa","Comments":"dsadsadsafdsfdsfdsfds","Status":"Working","RequestedBy":"requestname","DoesNotRequireCMR":null,"DeveloperTime":0},{"RequestID":1053,"IMNumber":"fdsfdsfds","CMNumber":"","RequirementsReceivedDate":"2017-04-20T15:04:39.75","PlannedImplementationDate":"2017-04-20T15:04:39.75","DevAssigned":"name","Title":"fdsfdsfdsfdsfdsfds","Description":"dsadsadsa","Comments":"dsadsadsadsa","Status":"Working","RequestedBy":"dsadsadsa","DoesNotRequireCMR":null,"DeveloperTime":999},{"RequestID":1054,"IMNumber":"dasdas","CMNumber":"","RequirementsReceivedDate":"2017-04-20T18:22:41.513","PlannedImplementationDate":"2017-04-20T18:22:41.513","DevAssigned":"name","Title":"dsadasdasda","Description":"dsadasdas","Comments":null,"Status":"Working","RequestedBy":"dsdasdasd","DoesNotRequireCMR":null,"DeveloperTime":0}]</string>
?
答案 0 :(得分:0)
您可以动态更改图片的src
。
<img data-src="{$product.cover.bySize.large_default.url}" src="loading.gif" />
在每张图片上循环并更新来源:
$('img[data-src]').each(function(){
var src = $(this).data('src');
$(this).attr('src',src');
})