使用ACF为jQuery动画添加唯一ID或数字到id的结尾

我有一切工作在html和jquery但我需要做的是分配和附加一个数字,以使唯一ID与Repeater字段一起工作。 这是HTML CSSjquery 。 有没有办法在#expand id的末尾附加一个唯一的数字(例如1或2 ……)?

以下是我们在这里的帮助下的代码:

  #expand-1 .bio-pic2, #expand-2 .bio-pic2 { position:absolute; top:0; left:0; } #expand-1, #expand-2 { position:absolute; width:1000px; border: 1px solid black; display: none; background-color:#ffffff; z-index:9999; height:323px; } .bio-pic2 img { position:absolute; top:0; left:0; width:323px; } .testimonial { position:absolute; top:333px; left:0; font-size:15px; } .desc { position:absolute; top:10px; left:333px; } .bio-pic { float:left; cursor: pointer; z-index:9998; margin:0 5px 0 0; } 

Name

Position

A testimonial!
This is a paragraph of text.

Name

Position

A testimonial!
This is a paragraph of text.
$(".bio-pic").click(function (e) { e.stopPropagation(); //$('.bio-pic2').toggle("slow"); var menu = $("#expand-"+$(this).attr("id").split("-")[1]); $(menu).show().animate({ width: 500 }, 1000); }); $("#expand-1, #expand-2").click(function () { $(this).animate({ width: 0 }, 1000, function () { $(this).hide(); }); })

这是jsfiddle http://jsfiddle.net/BrentRansom/h64CZ/4/的链接

改变身份……

 var myNum = 3; $('#expand').attr('id', 'expand' + myNum);