简体   繁体   English

是否可以在悬停时隐藏链接地址?

[英]Is it possible to hide link address on hover?

I have set up a chart with a lot of links and it really bugs me when it shows where the link goes in the bottom left hand side of the browser whenever you hover on a link, like so: 我已经设置了一个包含大量链接的图表,当它显示链接在浏览器左下角的位置时,无论何时将鼠标悬停在链接上,它都会让我感到烦恼,如下所示:

在此输入图像描述

Is it possible to remove this? 可以删除吗? any method will do as long as I can hide/remove it (HTML, CSS, JS etc..) 任何方法都可以,只要我可以隐藏/删除它(HTML,CSS,JS等...)

The status bar highlighting happens only when you use an <a> element with a set href . 仅当您使用具有set href<a>元素时,才会突出显示状态栏突出显示。

If you use pure JavaScript to open your link, and don't assign a href attribute, nothing will turn up in the status bar. 如果您使用纯JavaScript打开链接,并且未指定href属性,则状态栏中不会显示任何内容。 I don't know how much control you have over the chart html, but if it renders <a> tags there's not much you can do. 我不知道你对图表html有多少控制权,但如果它呈现<a>标签那么你就无能为力了。

You could try running javascript after the chart is renderred to attach onclick event handlers manually to all <a> tags and set href = '#' . 您可以尝试在渲染图表后运行javascript,以手动将onclick事件处理程序附加到所有<a>标记并设置href = '#'

As said here: how can url be hidden in hyperlink when mouse hover 如上所述: 当鼠标悬停时,如何将url隐藏在超链接中

Don't put the URL in the href (or keep it href="#") and attach a JavaScript function to the onclick event which puts the actual link in the a element. 不要将URL放在href中(或保持href =“#”)并将JavaScript函数附加到onclick事件,该事件将实际链接放在a元素中。 This way you won't see the actual URL when hovering over the link but the link will be inserted when the user actually clicks. 这样,当您将鼠标悬停在链接上时,您将看不到实际的URL,但会在用户实际点击时插入链接。

I had a similar problem that led me to this thread. 我有一个类似的问题导致我这个线程。 I figured I'd post my solution here rather than start a new thread about it. 我想我会在这里发布我的解决方案,而不是开始一个关于它的新线程。

I have a WordPress site with complex menus, and those menus had subheadings which the theme rendered as <a> links with empty href values. 我有一个带有复杂菜单的WordPress网站,这些菜单有副标题,主题呈现为<a>链接,带有空的href值。 The site manager didn't want the bottom corner to display as a link if those were hovered over, since they didn't work has a link anyway. 站点管理员不希望底角显示为链接,如果它们悬停在上面,因为它们无法正常工作。

<a href="#" class=" no_link" style="cursor: default;" onclick="Javascript: return false;">

I tried removing the "#" under href but it still showed the site's root url on hover. 我尝试删除href下的“#”,但它仍然显示网站的根网址悬停。

Since the anchor tag's class list already included no_link as a class, I simply added the following jQuery to the global JavaScript file: 由于anchor标记的类列表已经将no_link作为一个类包含在内,我只是将以下jQuery添加到全局JavaScript文件中:

$("a.no_link").removeAttr("href"); 

Note that the intention was to simply remove a link's address on hover if it wasn't supposed to be a functional link anyway. 请注意,目的是简单地在悬停时删除链接的地址,如果它不应该是一个功能链接。

Refer this link here : 请在此处参考此链接:

 http://www.experts-exchange.com/Web_Development/Miscellaneous/Q_21278295.html

However , if the chart is not under your control, then this may not nbe the way 但是,如果图表不在您的控制之下,那么这可能不适合

As suggested in the link : 如链接中所示:

<a href="www.google.com" onMouseOver="window.status=' '; return true;">Pink Floyd</a>

You can also use jQuery to bind the mouseover event on these anchor links without editing individual <a> 您还可以使用jQuery在这些锚链接上绑定mouseover事件,而无需编辑单个<a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM