Sven Hanefeld wrote:
Where can you find the the SCRIPT Includes from Gosha Bine, ?
I need the best solution.
Well, as Thomas said, there isn't any best solution; I've just mentioned
Mr Bine's work to propose an alternate conception, which had
interested me at the time. Reading back the script though, I realize
that I remembered it a bit incorrectly (mousemove being used only for NN4).
You'll find the script below; don't hesitate to use it "as is", it
remains, despite the slight UA detection[1], an excellent piece of code
likely to work in most browsers.
I've rebuilt the wrapping in order to have it displayed correctly in
most newsreaders.
Enjoy,
Yep.
[1] Maybe remove the appVersion test, it doesn't apply anymore.
---
/*
eazy rollovers
(c) gosha bine, 2001
http://www.stereofrog.com/js/
*/
var _iv=parseInt(navigator.appVersion);
if(_iv>3){
var _w=window.onload+"";
window.onload=_w?
new Function("event",
"_iload();"+
_w.substring(_w.indexOf("{")+1,_w.lastIndexOf("}") )
):_iload;
}
var _ib,_is;
function _imov(e){
var hif=0;
for(var ii=0;ii<_ib.length;ii++){
if(_ib[ii] && _ib[ii].complete){
var img=document.images[ii], b=img.border,
b2=b*2, dx=e.pageX-img.x+b, dy=e.pageY-img.y+b;
var s=(dx<0 || dx>(img.width+b2) || dy<0 ||
dy>(img.height+b2) || hif) ? _is[ii]:(hif=1,_ib[ii].src);
if(img.src!=s)img.src=s;
}
}
}
function hiSrc(src,n){
var k=src.lastIndexOf(".");
return (src.substring(0,k)+"_a"+src.substring(k));
}
function _iload(){
var uNav=0,uMoz=0;
if((navigator.appName.indexOf("Netscape")!=-1) &&
(navigator.userAgent.toLowerCase().indexOf("opera" )<0))
(_iv==4)?(uNav=1):(uMoz=1);
_ib=new Array();_is=new Array();
var sp=uMoz?"width":"complete";
for(var ii=0,ia=document.images;ii<ia.length;ii++){
var img=ia[ii],hs=hiSrc(_is[ii]=img.src,ii);
if(hs){
(_ib[ii]=new Image).src=hs;
if(!uNav){
img.onmouseover=
new Function("var i=_ib["+ii+"];if(i."+sp+")this.src=i.src");
img.onmouseout=new Function("this.src=_is["+ii+"]");
}
}
}
if(uNav){
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=_imov;
}
}