我正在尝试动态创建弹出窗口,而每个弹出窗口都没有相同的 id。问题是,当页面加载时,您选择其 id 的第一个弹出窗口将成为下一个弹出窗口的 id。如果不发生这种情况,我不确定如何有效地对其进行编码。
我的代码是:
// Display relative pop-ups to which link is clicked containing information about the field.
Y.delegate('click', function openPopUpInfo(e) {
var panel,
link = e.target.get('id'),
content = Y.one('#' + link + 'Info');
content.setStyle('display', 'block');
panel = new Y.Panel({
id: 'popUpPanel',
centered: true,
modal: true,
visible: false,
constrain: true,
render: true,
zIndex: 100,
bodyContent: content,
width: 350,
height: 250,
close: true,
plugins: [Y.Plugin.WidgetAnim, Y.Plugin.OverlayKeepaligned],
buttons: [{
value: '',
section: Y.WidgetStdMod.HEADER,
action: function (e) {
e.halt();
panel.hide();
}
}]
});
panel.show();
}, '#interestfreetab', '.infoLink');