我不确定这是否正确$('#bigImage').attr("data-big", LargeImagePath);但是同样的声明可以正常工作'src'.
IE浏览器.在JSP上我得到的值mediumImagePath但不大可能.attr不会使用,data-big所以我应该使用什么data-big.
xyz.js
function getImageDetails(mediumImagePath, LargeImagePath) {
alert(mediumImagePath+"_______"+mediumImagePath);
jQuery.ajax({
type : 'GET',
url : 'productDetailsPage.do',
data : {},
success : function(data) {
$('#bigImage').attr("src", mediumImagePath);
$('#bigImage').attr("data-big", LargeImagePath);
alert(data);
$("#productListPage").hide();
$("#productDetailsPage").show();
}
});
}
Run Code Online (Sandbox Code Playgroud)
这是div我试图设置这些值的地方:
Abc.Jsp
<div class="view-product">
<img id="bigImage" class="fancybox" src=""
data-big="images/home/suitlarge.jpg" />
<h3>ZOOM</h3>
</div>
Run Code Online (Sandbox Code Playgroud)
Productdiv.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div>
<c:forEach items="${products}" var="products">
<div class="col-sm-4">
<div class="product-image-wrapper">
<div class="single-products">
<div class="productinfo text-center">
<img src="${products.smallImage}" onclick="getImageDetails('${products.mediumImage}', …Run Code Online (Sandbox Code Playgroud)