设置id和添加CSS类到Poshy Tip工具提示div [英] Setting id and adding CSS class to Poshy Tip tooltip div

查看:173
本文介绍了设置id和添加CSS类到Poshy Tip工具提示div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置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'); 

您的Fiddle v2



UPDATE:向其中添加ID



您的小提琴v3


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');

Your Fiddle v2

UPDATE: add ID to it as well

Your Fiddle v3

这篇关于设置id和添加CSS类到Poshy Tip工具提示div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆