2010-06-01 76 views
3

这是我编写的Qtip.But不会工作。我不知道为什么?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> 

在此先感谢?

+0

什么是不工作?你得到什么错误信息? – 2010-06-01 11:38:50

回答

1

你的选择是对lookinf <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' 
});