问题描述
如何设置id或添加额外的CSS类到使用Poshy提示创建的工具提示div?我想能够区分在同一时间显示的不同工具提示。
我已经尝试在工具提示的初始化中添加额外的CSS类,但这打破了布局,因为有一些CSS生成的Poshy Tip的飞行,停止正常工作。该插件不提供设置ID的选项:
$('#tip')。poshytip ({
className:'tip-yellow',
//用下一行代替前一行打破布局:
// className:'tip-yellow extraClass',
//此选项不存在:
// id:'myId',
...
}
请参阅。
我们可以在初始化之后添加extraClass和设置myId吗?
我的jQuery技能有限,因此我只是忽略某些东西。 / p>
我无法使文本装饰工作,但我改变了颜色:
我注释掉了classname:'tip-yellow'
,并将其添加到底部:
$('。tip-yellow:last')。addClass('extraClass');
UPDATE:向其中添加ID
How do I set the id or add an extra CSS class to a tooltip div created with Poshy Tip? I'd like to be able to distinguish between different tooltips that are displayed at the same time.
I've tried adding the extra CSS class in the initialization of the tooltip, but this breaks the layout as there is some CSS generated on the fly by Poshy Tip that stops functioning correctly. The plugin provides no option to set the 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', ... }
See this fiddle.
Can we add extraClass and set myId after initialization?
My jQuery skills are limited, so chances are I'm simply overlooking something.
解决方案I couldn't get the text-decoration to work but I did change the color:
I commented out classname: 'tip-yellow'
and added this at the bottom:
$('.tip-yellow:last').addClass('extraClass');
UPDATE: add ID to it as well
这篇关于设置id和添加CSS类到Poshy Tip工具提示div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!