Free Web Hosting PHP/mySQL
GlobalWeb.com.ru Forum Index GlobalWeb.com.ru
Free Web Hosting :: Commercial Web Hosting :: PHP/mySQL :: CGI/Perl
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Make a "spotlight" on images

 
Post new topic   Reply to topic    GlobalWeb.com.ru Forum Index -> Javascript
Author Message
IH8Purple



Joined: 29 Feb 2004
Posts: 105
Location: Ottawa, Canada

PostPosted: Mon Mar 01, 2004 9:41 am    Post subject: Make a "spotlight" on images Reply with quote

put in this header

Code:
<style>
<!--

#myimage{
filter:light
}

-->
</style>


then this where you want the image

Code:
<img id="myimage" src="theimage.jpg">

<script language="JavaScript1.2">

//Image spotlight effect- By Erik F (die_schlampe@hotmail.com)
//Code enhancements by Dynamicdrive.com
//Visit http://www.dynamicdrive.com for this script

s = 50; // the size of the spotlight
vp = 10; // the visibility percent of the picture
startx = 0; // the top position of your sportlight into the image (on start)
starty = 0; // the left position of your spotlight into the image (on start)


//////////////////////////////////////////////////////////////////
//      No need to edit below this line         //
//////////////////////////////////////////////////////////////////

var IE = document.all?true:false

function moveL()
{
xv = tempX;
yv = tempY;
myimage.filters.light.MoveLight(1,xv,yv,s,true);
}

if (IE&&myimage.filters)
document.all.myimage.onmousemove = getMouseXY;
var tempX = 0
var tempY = 0


function getMouseXY(e) {
tempX = event.offsetX
tempY = event.offsetY

  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}
  if (t)
  { 
   moveL();
  }

  return true
}

var xv = startx;
var yv = starty;
var t= true;
if (IE&&myimage.filters){
myimage.style.cursor="hand";
myimage.filters.light.addAmbient(255,255,255,vp)
myimage.filters.light.addPoint(startx,starty,s,255,255,255,255)
}

</script>


end product is an image that is dark and when you mouse over, you get to see a little "spotlight" on where the mouse is
_________________
To Hell With Purple HQ (under constuction)
Cool webmaster forum
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
sam
Banned


Joined: 01 Mar 2004
Posts: 51
Location: IL

PostPosted: Mon Mar 01, 2004 1:19 pm    Post subject: Reply with quote

WOW
_________________
Back to top
View user's profile Send private message Visit poster's website
macabist
Banned


Joined: 01 Mar 2004
Posts: 35

PostPosted: Mon Mar 01, 2004 2:01 pm    Post subject: Reply with quote

thx!
Back to top
View user's profile Send private message
jalinds



Joined: 02 Mar 2004
Posts: 36

PostPosted: Tue Mar 02, 2004 9:17 am    Post subject: Reply with quote

WOW! That's really cool!!! Anyone has example for that code?? I wan't to see it working.
Back to top
View user's profile Send private message
i03m



Joined: 02 Mar 2004
Posts: 6

PostPosted: Tue Mar 02, 2004 10:13 am    Post subject: Reply with quote

Thank you very much. It's very coooooooool Cool
Back to top
View user's profile Send private message
asiammyself



Joined: 02 Mar 2004
Posts: 5

PostPosted: Tue Mar 02, 2004 11:53 am    Post subject: Reply with quote

wow cool! Cool
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    GlobalWeb.com.ru Forum Index -> Javascript All times are GMT
Page 1 of 1

 


Free Web Hosting, Commercial Web Hosting, PHP/mySQL Copyright © 2009
Free Scripts Directory | Free Software Downloads | Newsgroups Directory | Optel.net | Mirroraty | Cruised.net | Hardware Keylogger