Jump to content
php.lv forumi

onMouseOver-bilde OnMouseOut-cita bilde


eM^

Recommended Posts

Tieši tā pat kā ar krāsām. Gadījumā, kad imāge ir fonā:

 

onmouseover="this.style.backgroundImage='url(/path/to/image.jpeg)'"
onmouseout="this.style.backgroundImage='url(/path/to/another/image.jpeg)'"

 

Labāk, protams, to darīt ar klasēm.

 

P.S. Laikam labāk izmantot vienkāršus attēlus, savādāk IE ir problēmas ar background caching, kad tas mainās dinamiski (background image flickering).

Edited by GedroX
Link to comment
Share on other sites

andri,

 

javascript image preloading neder gadījumā, ja backs tiek uzdots caur CSS klasi (mans mīļākais variants - abi attēli - out and over - vienā attēlā).

 

http://solardreamstudios.com/learn/css/spritenav nav risinājums image flickering problēmai iekš IE6, kad Temporary Internet Files => Settings... ieslēgts uz Every visit to the page.

Edited by GedroX
Link to comment
Share on other sites

Par IE background image flicker problēmu:

 

Internet Explorer IE6 will try to reload every image file for every image element that you add to a webpage via JavaScript. For example changing html object class with background image dynamically.

 

The only solution found by now is adding and configurating module mod_expires for Apache.

 

Good description, tests and links on ahinea.com.

Link to comment
Share on other sites

×
×
  • Create New...