Originariamente inviato da macio-97
Non proprio è un pò fastidioso il fatto che segue il mouse il codice di andbaz và benissimo solo che non è l'effetto che cerco è simile come ho detto a questo
http://xenforo.com/community/
Come passi su un titolo del forum compare la descrizione)
Se il problema è tutto lì basta che rimuovi la funzione follow() e vedrai che starà fermo immobile
Poi per la grafica basta che modifichi il CSS…
codice:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Tooltip Example</title>
<script type="text/javascript">
var oTooltip = new (function() {
var nOverX, nOverY, nLeftPos, nTopPos, oNode, bOff = true;
this.remove = function () {
if (bOff) { return; }
bOff = true; document.body.removeChild(oNode);
};
this.append = function (oMsEvnt2, sTxtContent) {
if (!oMsEvnt2) { oMsEvnt2 = window.event; } // IE
oNode.innerHTML = sTxtContent;
if (bOff) { document.body.appendChild(oNode); bOff = false; }
var nScrollX = document.documentElement.scrollLeft || document.body.scrollLeft, nScrollY = document.documentElement.scrollTop || document.body.scrollTop, nWidth = oNode.offsetWidth, nHeight = oNode.offsetHeight;
nOverX = oMsEvnt2.clientX; nOverY = oMsEvnt2.clientY;
nLeftPos = document.body.offsetWidth - nOverX - nScrollX > nWidth ? nOverX + nScrollX + 10 : document.body.offsetWidth - nWidth + 16;
nTopPos = nOverY - nHeight > 6 ? nOverY + nScrollY - nHeight - 7 : nOverY + nScrollY + 20;
oNode.style.left = nLeftPos + "px";
oNode.style.top = nTopPos + "px";
};
this.init = function() {
oNode = document.createElement("div");
oNode.className = "tooltip";
oNode.style.position = "absolute";
};
})();
</script>
<style type="text/css">
div.tooltip {
padding: 6px;
background: #ffffff;
border: 1px #76808C solid;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
z-index: 9999;
}
</style>
</head>
<body onload="oTooltip.init();">
Move your mouse here…</p>
…or here!!</p>
</body>
</html>