开发者

Fancybox passing variable to append

I have fancybox. Now i need pass some variable in here.

append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"><div style="padding-left:5px;">NEED PASS VARIABLE HERE</div></div><div cl开发者_C百科ass="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')

How can I do? Or if I can split from title into "NEED PASS VARIABLE HERE"? Idea is but comment box bottom opened picture and comment box need picture ID. Maybe there is more simple way if yes then I am happy if somebody share with me?

Best Regards, R


You can always capture the click with jquery or javascript, when opening and on that click capture the ID you have it in the class or another place you want to and afterwards you can print it where you want it.

HTML

<a class="someclass id" href="">open</a>

JS

var params = $(this).attr('class').split(' ');
var id = params[1];

if you give more info, you get a better answer :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜