如何为使用 Poshy Tip 创建的工具提示 div 设置 ID 或添加额外的 CSS 类?我希望能够区分同时显示的不同工具提示。
我尝试在工具提示的初始化中添加额外的 CSS 类,但这会破坏布局,因为 Poshy Tip 即时生成的一些 CSS 停止正常运行。该插件不提供设置 id 的选项:
$('#tip').poshytip({
className: 'tip-yellow',
// Replacing the previous line with the next one breaks the layout:
// className: 'tip-yellow extraClass',
// This option doesn't exist:
// id: 'myId',
...
}
参见 this fiddle .
我们可以在初始化后添加extraClass并设置myId吗?
我的 jQuery 技能有限,所以我很可能只是忽略了一些东西。
最佳答案
我无法让文本装饰工作,但我确实改变了颜色:
我注释掉了classname: 'tip-yellow'
并在底部添加:
$('.tip-yellow:last').addClass('extraClass');
更新:同时添加 ID
关于javascript - 设置 id 并将 CSS 类添加到 Poshy Tip tooltip div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18064316/