»
EnglishFrenchVietnamese

Print - Trailing Kisses and Lips - JavaScriptBank.com

Full version: jsB@nk » Pointer » Trailer » Trailing Kisses and Lips
URL: https://www.javascriptbank.com/trailing-kisses-and-lips.html

Trailing Kisses and Lips © JavaScriptBank.comSpreading the love on your site with this JavaScript! It produces big kisses and lips behind your mouse pointer as it moves, each disappearing only after a noticeable delay (set to 1 second in demo). Works in NS6 as well.This is a good script to utilize during special occasions, such as Valentines.

Full version: jsB@nk » Pointer » Trailer » Trailing Kisses and Lips
URL: https://www.javascriptbank.com/trailing-kisses-and-lips.html



CSS
<style type="text/css"><!--h1 {  color:#cc3333;  font-family:"Comic Sans MS",Helvetica;}h3 {  color:#993333;  font-family:"Comic Sans MS",Helvetica;}.kisser {  position:absolute;  top:0;  left:0;  visibility:hidden;}--></style>


JavaScript
<script language="JavaScript1.2" type="text/JavaScript"><!-- cloak//Kissing trail- By dij8 (dij8@dij8.com)//Modified by Dynamic Drive for bug fixes//Visit http://www.dynamicdrive.com for this scriptkisserCount = 15 //maximum number of images on screen at one timecurKisser = 0 //the last image DIV to be displayed (used for timer)kissDelay = 1000 //duration images stay on screen (in milliseconds)kissSpacer = 50 //distance to move mouse b4 next heart appearstheimage = "lips_small.gif" //the 1st image to be displayedtheimage2 = "small_heart.gif" //the 2nd image to be displayed//Browser checking and syntax variablesvar docLayers = (document.layers) ? true:false;var docId = (document.getElementById) ? true:false;var docAll = (document.all) ? true:false;var docbitK = (docLayers) ? "document.layers['":(docId) ? "document.getElementById('":(docAll) ? "document.all['":"document."var docbitendK = (docLayers) ? "']":(docId) ? "')":(docAll) ? "']":""var stylebitK = (docLayers) ? "":".style"var showbitK = (docLayers) ? "show":"visible"var hidebitK = (docLayers) ? "hide":"hidden"var ns6=document.getElementById&&!document.all//Variables used in scriptvar posX, posY, lastX, lastY, kisserCount, curKisser, kissDelay, kissSpacer, theimagelastX = 0lastY = 0//Collection of functions to get mouse position and place the imagesfunction doKisser(e) {  posX = getMouseXPos(e)  posY = getMouseYPos(e)  if (posX>(lastX+kissSpacer)||posX<(lastX-kissSpacer)||posY>(lastY+kissSpacer)||posY<(lastY-kissSpacer)) {    showKisser(posX,posY)    lastX = posX    lastY = posY  }}// Get the horizontal position of the mousefunction getMouseXPos(e) {  if (document.layers||ns6) {    return parseInt(e.pageX+10)  } else {    return (parseInt(event.clientX+10) + parseInt(document.body.scrollLeft))  }}// Get the vartical position of the mousefunction getMouseYPos(e) {  if (document.layers||ns6) {    return parseInt(e.pageY)  } else {    return (parseInt(event.clientY) + parseInt(document.body.scrollTop))  }}//Place the image and start timer so that it disappears after a period of timefunction showKisser(x,y) {  var processedx=ns6? Math.min(x,window.innerWidth-75) : docAll? Math.min(x,document.body.clientWidth-55) : x  if (curKisser >= kisserCount) {curKisser = 0}  eval(docbitK + "kisser" + curKisser + docbitendK + stylebitK + ".left = " + processedx)  eval(docbitK + "kisser" + curKisser + docbitendK + stylebitK + ".top = " + y)  eval(docbitK + "kisser" + curKisser + docbitendK + stylebitK + ".visibility = '" + showbitK + "'")  if (eval("typeof(kissDelay" + curKisser + ")")=="number") {    eval("clearTimeout(kissDelay" + curKisser + ")")  }  eval("kissDelay" + curKisser + " = setTimeout('hideKisser(" + curKisser + ")',kissDelay)")  curKisser += 1}//Make the image disappearfunction hideKisser(knum) {  eval(docbitK + "kisser" + knum + docbitendK + stylebitK + ".visibility = '" + hidebitK + "'")}function kissbegin(){//Let the browser know when the mouse movesif (docLayers) {  document.captureEvents(Event.MOUSEMOVE)  document.onMouseMove = doKisser} else {  document.onmousemove = doKisser}}window.onload=kissbegin// decloak --></script>


HTML
<script language="JavaScript" type="text/JavaScript"><!-- cloak// Add all DIV's of heartsif (document.all||document.getElementById||document.layers){for (k=0;k<kisserCount;k=k+2) {  document.write('<div id="kisser' + k + '" class="kisser"><img src="' + theimage + '" alt="" border="0"></div>n')  document.write('<div id="kisser' + (k+1) + '" class="kisser"><img src="' + theimage2 + '" alt="" border="0"></div>n')}}// decloak --></script>


Files
/javascript/mouse/Trailing_Kisses_and_Lips/lips_small.gif/javascript/mouse/Trailing_Kisses_and_Lips/small_heart.gif