Jack Moore zoom()脚本以及如何在悬停时为多个图像更改img src

时间:2015-11-26 13:52:04

标签: javascript jquery html

我有多个具有这种结构的div:

[
     [
          {
               "startDateIso":"2015-11-26T12:00:00+010",
               "placeId":1
          },
          {
               "startDateIso":"2015-11-26T12:00:00+010",
               "placeId":2
          }
     ],
     [
          {
               "startDateIso":"2015-11-27T12:00:00+010",
               "placeId":3
          },
          {
               "startDateIso":"2015-11-27T13:00:00+010",
               "placeId":4
          }
     ]
]

js部分是:

<div class="container">
    <div class="zoom">
        <img src="http://mywebsite.net/images/products/small/image1.jpg" />
    </div>
</div>

悬停在.zoom div上我希望脚本从src加载img: http://mywebsite.net/images/products/big/image1.jpg

正如您所看到的,唯一的区别是$('document').ready(function () { $(".zoom").zoom({ url: 'big/image1.jpg', on: 'mouseover' }); }); 在网址中变为small

如何更改?

1 个答案:

答案 0 :(得分:1)

将您的JavaScript更改为:

{{1}}