I have 10 small pictures across the bottom of the screen and one main picture. What I am trying to achieve is having the main picture replaced by one of the 10 small pictures, when they are clicked on.
Code so far is:
$(function () {
$('#sp<?php echo $i; ?>').on {
'click', (function () {
$('#product-detail-pic').css('background-image', 'url(images/stock/<?php echo $stock[1][pic.$i]; ?>');
});
}
);
and the HTML/PHP is
<?php for($i=1;$i<6;$i++) {
if(($stock[1]['pic'.$i]!='')) { ?>
<div id="sp<?php echo $i; ?>" style="padding-right:13px; width:84px; height:61px; background:url(images/stock/<?php echo $stock[1]['pic'.$i]; ?>) no-repeat;float:left; background-size:84px 61px;">
<img src="images/zoom.png" width="40" height="30" />
</div>
<?php }