hansi wasd hansi wasd - 5 months ago 28
Javascript Question

simple qtip2 example does not work

i'm trying to get a simple qtip2 demo running but it wont work need help.
qtip2 is a framework that allows to create individual tooltips.
if you hover over the link a small yellow box should appear.

all files are in the same folder.



<html>
<head>
<title>My site</title>

<!-- CSS file -->
<link type="text/css" rel="stylesheet" href="jquery.qtip.css" />

</head>
<body>


<script type="text/javascript" src="jquery.min.js"></script>


<script type="text/javascript" src="jquery.qtip.js"></script>


<script type="text/javascript" src="jquery.imagesloaded.pkg.min.js"></script>


<a href="#test" title="My tooltip text">Sample link</a>

<script>
// self executing function here
(function() {

// your page initialization code here
// the DOM will be available here
$('a[title]').qtip();
})();
</script>

<a href="#test" title="My tooltip text">Sample link</a>
</body>
</html>




Answer

i removed unnessesary codes like the imagesloaded and replace the jQuery link you have with a CDN version.

And it works.

<html>
<head>
<title>My site</title>
<!-- CSS file -->
<link type="text/css" rel="stylesheet" href="jquery.qtip.css" />
</head>

<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js">          </script>
<script type="text/javascript" src="jquery.qtip.js"></script>
<a href="#test" title="My tooltip text">Sample link</a>
<script>
// self executing function here
(function() { $('a[title]').qtip(); })(); </script>
<a href="#test" title="My tooltip text">Sample link</a>
</body>
</html>
Comments