I would like to change pictures by going over them with the mouse in lighter
ones.
It must be very easy but I can't find the code for the best solution right
now.
Who can help me? 8 3167
"Sven Hanefeld" <ha******@nord-com.net> wrote in message
news:bo**********@news1.ewetel.de... I would like to change pictures by going over them with the mouse in
lighter ones. It must be very easy but I can't find the code for the best solution right now. Who can help me?
Just search google groups for 'image rollovers'.
Sven Hanefeld wrote: I would like to change pictures by going over them with the mouse in lighter ones. It must be very easy but I can't find the code for the best solution right now. Who can help me? http://pointedears.de.vu/scripts/test/hoverMe is a solution but not the best
one (I'm working on v2.1 :-))
PointedEars
P.S.
Your line-break is b0rken (I skipped the rewrapping here.) Set it below
80 characters per line, 72-76 is recommended. And if you use automagic
line-break, avoid manual ones in paragraphs.
Thomas 'PointedEars' Lahn wrote: I would like to change pictures by going over them with the mouse in lighter ones. http://pointedears.de.vu/scripts/test/hoverMe is a solution but not the best one (I'm working on v2.1 :-))
The route you've taken in the 2.0 is a fine one, although I do have some
suggestions, if you like:
- I'd recommend to add some relatedTarget checks in the script,
- I'd also use some container for the images (in order to keep the
namespace as clean as possible).
It makes me think of a script by Gosha Bine, named "eazyroll.js", which
automated rollovers, but using a completely different conception which
you may find interesting[1].
The idea was to add a handler for the mousemove event and study the
target; if it was an image, then there was a check to see if an
alternate image existed, then a source change according name conventions
(the alternate image had to have "_a" as a postfix).
The immediate benefit was the simplicity for the programmer: he/she just
had to insert a SCRIPT include and that was all (no links, no
mouseover/mouseout coding, nothing else). And of course this was working
on major browsers (NN4+, IE4+).
Cheers,
Yep.
[1] I, for sure, was at the time extremely interested! I was then a
beginner in js (not that I'm an expert now), and his scripts made me
make huge progress and, more generally, fed my interest for programming
(I don't have a technical background). That's all nostalgy for me, when
I was taking the night bus in the Swedish winter, reading printed
scripts :-)
I allready got it now. Just didn't know the expression image rollover.
Thanks for help...
Another question:
Where can you find the the SCRIPT Includes from Gosha Bine, ?
I need the best solution.
"Yann-Erwan Perio" <y-*******@em-lyon.com> schrieb im Newsbeitrag
news:3f***********************@news.free.fr... Thomas 'PointedEars' Lahn wrote:
I would like to change pictures by going over them with the mouse in
lighterones. http://pointedears.de.vu/scripts/test/hoverMe is a solution but not the
best one (I'm working on v2.1 :-))
The route you've taken in the 2.0 is a fine one, although I do have some suggestions, if you like: - I'd recommend to add some relatedTarget checks in the script, - I'd also use some container for the images (in order to keep the namespace as clean as possible).
It makes me think of a script by Gosha Bine, named "eazyroll.js", which automated rollovers, but using a completely different conception which you may find interesting[1].
The idea was to add a handler for the mousemove event and study the target; if it was an image, then there was a check to see if an alternate image existed, then a source change according name conventions (the alternate image had to have "_a" as a postfix).
The immediate benefit was the simplicity for the programmer: he/she just had to insert a SCRIPT include and that was all (no links, no mouseover/mouseout coding, nothing else). And of course this was working on major browsers (NN4+, IE4+).
Cheers, Yep.
[1] I, for sure, was at the time extremely interested! I was then a beginner in js (not that I'm an expert now), and his scripts made me make huge progress and, more generally, fed my interest for programming (I don't have a technical background). That's all nostalgy for me, when I was taking the night bus in the Swedish winter, reading printed scripts :-)
Sven Hanefeld wrote: I allready got it now. Just didn't know the expression image rollover.
Another expression for it is `hover (image/)effect'.
Where can you find the the SCRIPT Includes from Gosha Bine, ?
Since his/her website seems not to be available, you could try to send
her/him e-mail: http://www.google.com/search?q=%22Gosha+Bine%22
I need the best solution.
I do not know if his/her script is the best solution.
What the best solution is, also depends on your needs.
Maybe you want to take hoverMe 2.0 now and upgrade later ;-)
[Top post, TOFU]
Please read http://got.to/quote and avoid top posts in the future.
PointedEars
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;
}
}
Yann-Erwan Perio wrote: Thomas 'PointedEars' Lahn wrote: I would like to change pictures by going over them with the mouse in lighter ones. [<http://pointedears.de.vu/scripts/test/hoverMe>]
[...] - I'd recommend to add some relatedTarget checks in the script,
-v
- I'd also use some container for the images (in order to keep the namespace as clean as possible).
hoverMe 2.1 being still beta, I have enhanced
v2.0 a bit -- v2.01 is release is available!
<http://pointedears.de.vu/scripts/test/hoverMe>
See hoverMe-2.0 for the previous version. With Navigation Bar,
you can just click the `Previous' button.
PointedEars
Thomas 'PointedEars' Lahn wrote: [...] - I'd recommend to add some relatedTarget checks in the script,
-v
Ah, but about what? "Related target" issues[1], or why I'd recommend to
add related checks [2] ;-)
[1] When you define mouse events on elements which contain other
elements, you might be getting 'unexpected' handlers calls, as browsers
(as of IE, Mozilla) consider that before "mousing" over the inner
element you're "mousing" out of the outer element. As a result,
especially for rollovers, you get image flickering.
There are many solutions to this, for instance:
- don't leave any space between tags, like you did in your example;
- don't use mouseover/out but rather mouseenter/leave (support limited
to IE IIRC);
- manage handlers by capturing events, studying the related target
(fromElement/toElement in IE), so that they get called only when a
"real" mouse action has happened.
[2] The solution you've used is certainly the simplest one, but you
cannot, IMHO, expect the programmer to understand this point or even be
willing to adapt his/her HTML presentation (not even structure) to
satisfy the requirements of the javascript, the implementation should
rather take care of the issue.
Hence my suggestion :-)
hoverMe 2.1 being still beta, I have enhanced v2.0 a bit -- v2.01 is release is available!
What about 2.1's beta's release :-p
Regards,
Yep. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: laurie |
last post by:
Hi.
I have a DIV section that has many thumbnail images inside it. I have a DIV so all images can fit in a row and the horizontal
scroll bar is used to move the thumbnails from left to right.
Does anyone know any code to have the DIV scroll from left to right when I use an onmouseover on two images either side of the
DIV?
Thanks
Laurie
|
by: Richard |
last post by:
I know I can have like <a href="#" onclick="dothis" onmouseover="dothat">
But how do you properly code two mouseover's in one statement?
<a href="#" onmousever="dothis" onmouseover="dothat">
As an example of use:
Column A holds menu items.
When a mouse over is performed, two actions take place instead of one.
Action one sends an image to a...
|
by: windandwaves |
last post by:
Hi Gurus
I am trying to make this rather complicated maps with an a huge number of mouseovers and the like.
I want to set up a function that OnMouseDown swaps the OnMouseOver and OnMouseOut for the same element.
E.g.
<A HREF="#"
OnMouseOver="A(); return true"
OnMouseOut"B(); return true;"
|
by: news.west.cox.net |
last post by:
I have been writing a practice sliding div navigation script. I am finding
myself in the position where I need to force a div into showing the hover
behavior defined in css.
So my question is this. If I have two divs, is there a way to make the
second div display its onmouseover behavior when the mouse is over div 1?
|
by: drjackk |
last post by:
Hello,
I'm trying to change the onmouseover event dynamically.
This sets-up the initial onmouseover event:
<a href="home.html"> <img border="0" id="img22"
src="images/home1.jpg" height="15" width="85" alt="Home"
onmouseover="FP_swapImg(1,0,/*id*/'img22',/*url*/'images/home2.jpg')"</a>
| |
by: MrCode2k |
last post by:
Hello,
Trying to do: I just want a table that I can scroll and that has fixed
headers.
Problem: I got it to work but when I added the onmouseover event it
didn't work anymore.
Replicate-Problem: Scrolldown the textbox and put the mouse over a row.
|
by: MrCode2k |
last post by:
Hello,
Trying to do: I just want a table that I can scroll and that has fixed
headers.
Problem: I got it to work but when I added the onmouseover event it
didn't work anymore.
Replicate-Problem: Scrolldown the textbox and put the mouse over a row.
|
by: Justin Rowe |
last post by:
I'm attempting to design a site with alot of dynamic content and
intractability, however I've hit a snag when it comes to the function of
the onMouseOver and onMouseOut events. Using a bit of code from
QuirksMode to grab the location of the mouse, I've built a tooltip
function to show a tooltip to the user depicting the target of a link,
the...
|
by: den2005 |
last post by:
Hi everybody,
I am confused and still looking why this codes is not working. Can anyone notice or know why this code is not working? Thanks in advance.
Code working:
<form id="form1" runat="server">
<div>
</div>
<div>
|
by: oopaevah |
last post by:
I have written some dom code to create a list of divs, each with it's
own id. I want to set the onmouseover and onmouseout events to
highlight the div when the mouse is over it. However I cannot use the
method below because oDiv.id is always set to the last div I create -
so the last div is highlighted regardless of which div I am onmouseover...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |