【问题标题】:Anything Zoomer plugin, Cannot read property 'left' of undefined任何 Zoomer 插件,无法读取未定义的属性“左侧”
【发布时间】:2013-05-24 11:59:03
【问题描述】:

我使用这个标记:

<div id="zoom">
    <div id="small">
        <img id="image1" src="images/1.jpg" alt="example" title="Image" class=" img-polaroid">
    </div>
    <div id="large">
        <img id="image2" src="images/1.jpg" alt="example" title="Image" class=" img-polaroid">
    </div>
</div>

我是这样打电话的:

jQuery(document).ready(function(){
    jQuery("#zoom").anythingZoomer()
});

我的 jQuery 版本是:1.8.3

当我将鼠标悬停在图像上时,它显示无法读取未定义的属性“左侧”,

https://github.com/CSS-Tricks/AnythingZoomer

请帮忙。

【问题讨论】:

  • DOM 加载完成后是否调用jQuery("#zoom").anythingZoomer({ expansionSize: 30, speedMultiplier: magnifymultiplier, });
  • 您是否尝试将代码封装在 .ready() api.jquery.com/ready\ 函数中??
  • 是的,它在 document.ready() 中

标签: jquery zooming deepzoom


【解决方案1】:

这可能是现有 JS 插件的问题,也可能是由于 jQuery 的某些版本冲突。 尝试创建一个新的空白页并在那里运行您的代码。 最好的方法是使用插件演示文件中给出的代码。

【讨论】:

    【解决方案2】:

    插件正在寻找类名,因此将缩放中标记的 ID 切换为类:

    <div id="zoom">
        <div class="small">
            <img class="image img-polaroid" src="images/1.jpg" alt="example" title="Image">
        </div>
        <div class="large">
            <img class="image img-polaroid" src="images/1.jpg" alt="example" title="Image">
        </div>
    </div>
    

    另外,img 都有一个 image 的 ID,它们应该是唯一的。我已将它们更改为上面的类名,但如果您需要某些 ID,则将它们设为唯一。

    【讨论】:

      猜你喜欢
      • 2013-03-10
      • 2019-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-23
      • 2021-07-04
      • 1970-01-01
      相关资源
      最近更新 更多