gpt4 book ai didi

jquery - 将 id 的值发送到 fancy box

转载 作者:行者123 更新时间:2023-12-01 08:25:36 24 4
gpt4 key购买 nike

我有不同的 id 属性值,我需要将其发送到精美的盒子。

$('a.Links').click(function() {                        
var clickID = $(this).attr('id') ;
alert(clickIDID);
});

$("#"+clickID).fancybox({
'width' : '75%',
'height' : '75%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
'titlePosition' : 'outside',
'content' : 'testl'
});

如何将 clickID 的值发送到 .fancy 框。我尝试在单击功能中添加 .fancybox,但这不起作用。详细信息请参阅上一个问题
the index value of attribute

最佳答案

假设您的所有 ID 均以“popup_”一词开头(popup_1、popup_2 等),那么您可以使用 Attribute Starts With像这样的选择器:

// initialize fancybox for all elements with ID starting with 'popup_'
$("[id^=popup_]").fancybox({
'width' : '75%',
'height' : '75%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
'titlePosition' : 'outside',
'content' : 'testl'
});

但是,使用类属性来集中处理它们会更直接,如下所示:

<a class="popup">Foo</a>
<img class="popup" src="foo.jpg"/>

$(".popup").fancybox({
...

关于jquery - 将 id 的值发送到 fancy box,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4221396/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com