製品のカタログを持っています。サムネイルをロールオーバーすると、製品の説明がツールチップ(Cluetip)に表示されます。Cluetipをアクティブにしたときに、関連する画像の周囲に影を表示する必要があります。
そのために、画像の周りに影のある別のdivを作成しました。これは、Cluetipがアクティブ化されたときにdivをターゲットにする方法です。
onActivate: function() { $("#shadow").fadeIn(1000); }
しかし、私の場合、問題はCMSがdivのIDを動的に生成するため、#shadow6、#shadow8、#shadow17などの名前が付けられていることです。
私の質問は、Cluetipがアクティブ化されたら、特定の動的divのIDをターゲットにする方法です。
jQuery:
<script type="text/javascript">
$(document).ready(function () {
$('.thumbnail').cluetip({
fx: {
open: 'fadeIn',
openSpeed: '2000'
},
showTitle: false,
cursor: 'pointer',
positionBy: 'auto',
height: '210px',
topOffset: 0,
leftOffset: 20,
local: true,
sticky: true,
mouseOutClose: true,
onActivate: function () {
$("#shadow").fadeIn(1000);
},
onHide: function () {
$("#shadow").fadeOut(300);
}
});
});
</script>
HTML / PHP(ループ内)
<div id="shadow{$obj_id}" style="position: absolute; display:none;
width:150px; height:190px;"></div>
<div class="thumbnail">
<img src="/images/product.jpg" />
</div>
実際のコード
<div id="shadow1"></div>
<a href="/shoe-model-name.html">
<span class="cm-template-box" template="common_templates/image.tpl" id="te3">
<img class="cm-template-icon hidden" src="/skins/test/customer/images/icons/layout_edit.gif" width="16" height="16" alt="" />
<img class="thumbnail" rel="#popupz1" src="/images/product-tmb.jpg" width="150" height="180" alt="" /></span>
</a>