我正在寻找jQuery的工具提示插件,它将允许以下类型的行为.
<a href="somewhere.html">
<span>
<img src="someimage.jpg" style="display: none;" />
Here is the tooltip content.
</span>
Here is the link to somewhere.
</a>
Run Code Online (Sandbox Code Playgroud)
我希望的行为是将鼠标悬停在"这里是某个地方的链接"上,并弹出一个工具提示,显示包含"someimage.jpg"和"这是工具提示内容"的范围内容.
我希望工具提示跟踪鼠标在链接上的移动以及工具提示的外观(背景颜色,不透明度,边框颜色等)是可配置的.
我发现的两个最流行的工具提示,"clueTip"和JörnZaefferer的"工具提示"似乎不符合要求,除非我遗漏了一些东西.
最终,链接和图像将动态生成.
当用户将鼠标悬停在具有title属性的锚标记上时,有没有办法隐藏原生工具提示操作?我不想删除它只是不显示令人讨厌的黄色框,这是默认的工具提示操作.
更新:
在阅读了其他几篇帖子之后,我认为我不能隐藏本机工具提示操作的title属性,但我想在这里开箱即用.我可以在锚标记内使用另一个属性而不是title属性,并且仍然保留有效页面???
删除标题属性值不是一个选项,除非有人可以弄清楚如何将其添加回onclick事件?
下面的工作代码
$('[title]').each( function() {
var $this = $(this);
$this.data('title',$this.attr('title'));
$this.removeAttr('title');
});
$('a').click( function() {
var $this = $(this);
var title = $this.data('title');
... do your other stuff...
});
Run Code Online (Sandbox Code Playgroud) 我有一张表,每行代表一张图片.在路径I中,存储其绝对路径.字符串有点长,我想当我将鼠标悬停在特定单元格上时,工具提示应弹出包含来自单元格的信息的鼠标旁边.
我们最近将jQuery升级到1.9.0,但它打破了我们的醉意插件.它的live功能现在导致错误.
$('.tooltip, abbr').tipsy({
live: true
});
TypeError: this[binder] is not a function
Run Code Online (Sandbox Code Playgroud)
是否有任何修复或补丁?谷歌搜索没有带来任何有用的东西.
更新:
谢谢你的回答.我决定尝试自己修复这个问题,因为我找不到任何补丁.
经过检查,错误似乎很容易追查.可以轻松修补tipsy插件以使用on功能而不是已弃用的live功能.在tipsy插件中,我替换了以下代码:
if (options.trigger != 'manual') {
var binder = options.live ? 'live' : 'bind',
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
this[binder](eventIn, enter)[binder](eventOut, leave);
}
Run Code Online (Sandbox Code Playgroud)
有:
if (options.trigger != 'manual') {
var eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
eventOut = options.trigger == 'hover' ? 'mouseleave' …Run Code Online (Sandbox Code Playgroud) 我有一个winform应用程序,它具有动态数字(基于数据库值)PictureBoxes.每个P-Box都有一个Tooltip控件.
如何在没有任何内存泄漏的情况下更改ToolTip文本?现在,我有以下代码,但它正在泄漏内存=>之前的ToolTip控件没有得到GC.
顺便说一句,这是一个尝试更新主UI线程的后台线程....
if (pictureBox == null || !pictureBox.IsHandleCreated) {
continue;
}
Action setTooltipAndImage = () => {
var toolTip = new ToolTip();
GameServer tempGameFile = gameServer;
toolTip.SetToolTip(pictureBox, string.Format(...));
pictureBox.Image = Resources.RedButton;
};
if (pictureBox.InvokeRequired) {
pictureBox.Invoke(setTooltipAndImage);
} else {
setTooltipAndImage();
}
Run Code Online (Sandbox Code Playgroud)
正如我所说 - 这有效,但它正在泄漏.
有人有什么建议吗?
我刚刚从Windows 7将我的PC移动到Windows 8,在运行我们的WPF应用程序时,我注意到我们的WPF弹出窗口和/或工具提示现在默认情况下位于左下角,而不是正常的右下角.有没有人注意到这个?我知道你可以在xaml的每个工具提示中指定它们的位置,但我们有很多工具提示和弹出窗口.我想知道是否有办法在WPF应用程序中全局指定默认位置.谷歌在这个问题上没有取得很多成果.我们有理由将它们保持在相同的原始默认位置(某些弹出窗口具有相对于其启动位置的内容).
Windows 8 :(左下)

Windows 7 :(右下)

相同的代码!标准的"工具提示"xaml属性.
有任何想法吗?
已经解决,我发表了评论
好的,我发现了这个问题.它与平板电脑/触摸屏有关.(左撇子...右手偏好)这另一个链接提供了一个原因.我正在制定一个解决方案来解决这个问题.生病了很快就会发布!
使用jquery插件工具提示工具提示(http://flowplayer.org/tools/tooltip/index.html)我需要更改元素的标题..
reloadTooltip();
$("#example").attr('title', obj.text);
reloadTooltip();
function reloadTooltip(){
$("[title]").tooltip({ position: "bottom right", opacity: 1 });
}
Run Code Online (Sandbox Code Playgroud)
Html部分:
<span title="text" id="example"></span>
Run Code Online (Sandbox Code Playgroud)
凭借我的解决方案,我终于获得了2个冠军,一个在另一个之上 没有风格(被忽略的js),是新的.工具工具提示标题尚未更改.
谢谢
我想设置ToolTip maxwidth属性以正确显示长文本.另外我需要文字包装.我用过这种风格:
<Style TargetType="ToolTip">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding}" MaxWidth="400" TextWrapping='Wrap' />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
这个工具提示风格适合我的目的.但是,对于某些具有自己工具提示风格的控件来说,它无效.例如,无法显示以下按钮的工具提示.
<Button>
<Button.ToolTip>
<StackPanel>
<TextBlock Style="{StaticResource firstText}" Text="aaaaaaaaaaaaa"/>
<TextBlock Style="{StaticResource secondText}" Text="bbbbbbbbbbbbb"/>
<TextBlock Bacground="Red" Text="ccccccccccccc"/>
</StackPanel>
</Button.ToolTip>
</Button>
Run Code Online (Sandbox Code Playgroud)
我想为所有工具提示设置文本换行的maxwidth属性.我能为这个问题做些什么?
我的图表上的标签显示在工具提示上,看起来不太好.我试着玩zIndex,但没有结果.如何使工具提示不透明?这是我的jsFiddle:http://www.jsfiddle.net/4scfH/3/
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'graf1',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
margin: 40,
text: 'Podíl všech pot?eb'
},
tooltip: {
//pointFormat: '<b>{point.y} K? [{point.percentage}%]</b>',
percentageDecimals: 2,
backgroundColor: "rgba(255,255,255,1)",
formatter: function() {
return this.point.name + '<br />' + '<b>' + Highcharts.numberFormat(this.y).replace(",", " ") + ' K? [' + Highcharts.numberFormat(this.percentage, 2) + '%]</b>';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: …Run Code Online (Sandbox Code Playgroud)tooltip ×10
jquery ×5
.net ×2
wpf ×2
xaml ×2
c# ×1
delphi ×1
delphi-7 ×1
highcharts ×1
java ×1
javascript ×1
jquery-tools ×1
jtable ×1
labels ×1
listener ×1
live ×1
picturebox ×1
swing ×1
tipsy ×1
title ×1
windows-7 ×1
windows-8 ×1
winforms ×1
wpf-controls ×1