gpt4 book ai didi

php - Qtip 不适合我?

转载 作者:搜寻专家 更新时间:2023-10-31 21:46:20 26 4
gpt4 key购买 nike

这是我为 Qtip 编写的代码。但它不会工作。我不知道为什么?

<!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>Qtip</title>
<script type="text/javascript" src="/jquery demos/jquery1.4.2.js"></script>
<script type="text/javascript" src="jquery.qtip-1.0.0-rc3.js"></script>
<script>
$(document).ready(function()
{
// Match all link elements with href attributes within the content div
$("#content a[href]").qtip({
content: 'This is an active list element',
show: 'mouseover',
hide: 'mouseout'
});
});
</script>
</head>
<body>
<a href='#' id="content" class="qtip">sdfsfsd</a>
</body>
</html>

提前致谢?

最佳答案

您的选择器正在查找 <a href="something"> 内部 #content ,所以只需删除该部分,如下所示:

$("#content").qtip({
content: 'This is an active list element',
show: 'mouseover',
hide: 'mouseout'
});

选择器之间的空格意味着寻找与前一个选择器匹配的 后代 ...更正但过大的选择器看起来像这样:"a[href]#content" ,但是......这是矫枉过正(因此效率低下)。您使用的选择器适用于 #content元素内部有链接,像这样:

<div id="content">
<a href='#' class="qtip">sdfsfsd</a>
</div>

或者只使用 qtip你已经拥有的类,像这样:

$(".qtip").qtip({
content: 'This is an active list element',
show: 'mouseover',
hide: 'mouseout'
});

关于php - Qtip 不适合我?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2949377/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com