このHTMLコードを取得しました:
<div class="gallery" id="gallery_x">
<p>
<a href="http://a-dynamic-link.com">image1</a>
<a href="http://another-dynamic-link-com">image2</a>
</p>
</div>
(x = 変数番号)
.gallery div から ID を取得し、次のように rel として "a" に適用する必要があります。
<div class="gallery" id="gallery_x">
<p>
<a rel="gallery_x" href="http://a-dynamic-link.com">image1</a>
<a rel="gallery_x" href="http://another-dynamic-link-com">image2</a>
</p>
</div>
これまでの私の(動作していない)ソリューションは次のとおりです。
$(".gallery a").parents(".gallery").attr("rel", $(this).attr("id"));
誰かが私を助けてくれたらうれしいです。
ありがとうございました。
ディー