&引用;选择器无效或丢失&引用;使用jQuery标题(Capty)插件时

&引用;选择器无效或丢失&引用;使用jQuery标题(Capty)插件时,jquery,prestashop,Jquery,Prestashop,我在想为什么我不能让它工作。我正在使用jQuery Capty插件 在prestashop中,我在产品列表.tpl上使用了这个 将其包含在产品列表的顶部。tpl: <script type="text/javascript"> $('#animation').capty({ animation: 'fade', speed: 400 }); </script> $(“#动画”).capty({ 动画:“淡入淡出”, 速度:400 }); 这也在a

我在想为什么我不能让它工作。我正在使用jQuery Capty插件

在prestashop中,我在
产品列表.tpl
上使用了这个

将其包含在
产品列表的顶部。tpl

<script type="text/javascript">
$('#animation').capty({
  animation: 'fade',
  speed:     400
});
</script>

$(“#动画”).capty({
动画:“淡入淡出”,
速度:400
});
这也在a href中的图像文件中

 <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" class="img-responsive" id="animation" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
getImageLink($product.link_rewrite,$product.id_image,'home_default')}”class=“img responsive”id=“animation”alt=“{$product.name | escape:'htmlall':'UTF-8'}”{if-isset($homeSize)width=“{$homeSize width}”height=“{$homeSize height.height}{/if}/>
我得到的错误是:

选择器无效或丢失


不过,我似乎无法让它工作。有什么建议吗?我相信我是按照说明操作的,但这就是我肯定遗漏了什么的地方。

我认为发生这种情况是因为您分配了选择器id=“动画”“在循环中。所以在DOM中不能得到uniq ID元素。让我们尝试对页面中的每个产品图像使用class而不是id或init js plugin,例如:

$('#animation_1, #animation_4, #animation_3').capty({...

getImageLink($product.link_rewrite,$product.id_image,'home_default')}”class=“img responsive”id=“animation_{$product.link_rewrite}”alt=“{$product.name}escape:'htmlall':'UTF-8'}{if isset($homeSize)width=“{$homeSize hide.width}”height=“{$homeSize height.height}{/if}>

Hey Alexander,感谢您的回复。:)我尝试了这个精确的解决方案,但没有效果。不幸的是,我在控制台中得到了相同的响应。我不确定还可以尝试什么,您认为我还应该研究什么吗?谢谢!
<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" class="img-responsive" id="animation_{$product.link_rewrite}" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />