【发布时间】:2015-07-31 22:44:42
【问题描述】:
我正在尝试制作一个工具提示,但我需要它在用户取消悬停时保持悬停。
另外,我正在尝试向该工具提示添加一个关闭按钮,该按钮将保持“悬停状态”,当用户单击它时,我想让它记住 cookie,这样它就不会再次为该 cookie 打开.
我是 javascript 和 jQuery 的新手,几天来我一直在思考这个问题。
这是我的代码:
@charset "utf-8";
/* Tooltip CSS Created By Deni*/
.tooltip-container {
width: 400px;
height: 300px;
background: #DBDBDB;
border: 1px solid black;
margin: 10% auto;
}
/* Start the tooltip css */
.tooltip {
position: relative;
z-index: 9998;
cursor: help;
}
.tooltip > span {
display: none;
}
.tooltip:hover {
z-index: 9999;
}
.tooltip:hover .tooltip-data {
display: block;
width: 150px;
padding: 5px;
color: #dadada;
background-color: #A35FA1;
font-size: 11px;
border-radius: 5px;
text-decoration: none;
font-family: century gothic;
position: absolute;
bottom: 20px;
left: -10px;
text-align: center;
}
.tooltip-container > a {
margin-right: 10px;
}
.permhover {
display: block;
opacity: 1;
}
**HTML:**
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tooltip</title>
<link href="tooltip.css" rel="stylesheet" type="text/css" />
<script src="jquery-1.11.3.min.js" type="text/javascript"></script>
</head>
<body>
<div class="tooltip-container">
<a href="javascript:;" class="tooltip">This is the information<span class="tooltip-data"> This is one Tooltip!</span></a>
<a href="javascript:;" class="tooltip">This is the information <span class="tooltip-data"> This another one Tooltip!</span></a>
</div>
</body>
</html>
我知道这并不多,但感谢所有帮助。非常感谢。
【问题讨论】:
标签: javascript jquery html css cookies