<?php
for ($i = 0; $i < $count_images; $i++)
{
$image = $this->product->images[$i];
?>
<li>
<a href="javascript:void(0)" onClick="change(<?php echo $image->file_url; ?>)"><?php echo $image->displayMediaThumb('class="product-image"style="cursor: pointer"',false,""); ?></a>
</li>
<?php } ?>
<script type="text/javascript">
function change(url)
{
alert(url);
}
</script>
我希望在用户点击缩略图时更改大图片中显示的图片
答案 0 :(得分:0)
in components/com_virtuemart/views/product_details/default_images.php
if (!empty($this->product->images))
{
$image = $this->product->images[0];
?>
<div class="main-image">
<?php
echo $image->displayMediaFull('id="product_image"',true,"rel='vm-additional- images'");
?>
<div class="clear"></div>
</div>
<script type="text/javascript">
function change(url)
{
document.getElementById('product_image').src=url;
}
</script>