2014-03-14 58 views
-3

我正在尝试使用Poshy Tip jQuery Plugin。我做了一个非常简单的HTML页面:如何包含jQuery插件?

<!DOCTYPE html> 
<html> 
    <title>PoshyTip</title> 
    <body> 
     <center> 
      <a href="#" id="tip">Google</a> 
     </center> 
    </body> 

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
    <script src="jquery.poshytip.min.js"></script> 
    <script> 
     $('#tip').poshytip(); 
    </script> 
</html>  

我有.js文件在同一文件夹中的HTML页面。但是,我没有看到提示。 我在这里做错了什么?

什么是在控制台:

event.returnValue is deprecated. Please use the standard event.preventDefault() instead. 

就是这样。

+0

JS文件未找到,请检查Web控制台如果文件被加载 – Rex

+0

什么是错误控制台显示? –

+0

检查控制台。我没有看到任何错误:) –

回答

1

你错过title你的HTML锚点:

<a href="#" title="This is a title" id="tip">Google</a> 

此外,你缺失的poshytip CSS文件中引用,在这里我使用skyblue主题:

<link rel="stylesheet" href="http://vadikom.com/demos/poshytip/src/tip-skyblue/tip-skyblue.css" /> 

您还需要更改jQuery代码t Ø通过指定className加载自定义CSS主题:

$('#tip').poshytip({ 
    className: 'tip-skyblue', 
    bgImageFrameSize: 9, 
    offsetX: 0, 
    offsetY: 20 
}); 

Fiddle Demo

0

您没有指定标题。

<a href="#" id="tip">Google</a> 

应该

<a href="#" title="Google - a search Engine" id="tip">Google</a> 

的医生说:

显示标题 属性值的默认浏览器提示被替换为 “poshier” 版本:

+0

好的..我是网络开发新手:) –

0

将链接更改为

<a href="#" id="tip" title="Google">Google</a> 

DEMO