javascript-php array traversal problem, JS problem, mainly click on the product thumbnail, click the event to make big,

Source: Internet
Author: User

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';}
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.