PHP array traversal problem, JS problem, mainly click on the product thumbnail, click the event to make big,
Now it's time to click on the first picture and the following graphs are the first to enlarge the picture
The code is as follows
{foreach from= $goods _list item=goods}
Reply content:
PHP array traversal problem, JS problem, mainly click on the product thumbnail, click the event to make big,
Now it's time to click on the first picture and the following graphs are the first to enlarge the picture
The code is as follows
{foreach from= $goods _list item=goods}
Just replace your picBig
code.
function picBig() { var $ = document.querySelector.bind(document); var img = event.currentTarget.children[0]; // 获取当前点击的图片 var url = img.getAttribute('src'); // 获取当前点击的图片地址 // 获取大图 img 元素并设置要显示的图片地址 $('#divCenter > a > img').setAttribute('src', url); // 显示预览框 $('#divCenter').style['display'] = 'block';}