Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
49
rated 0 times [  53] [ 4]  / answers: 1 / hits: 16121  / 14 Years ago, thu, april 15, 2010, 12:00:00

I would like to brighten an image on my webpage on mouseover using css or javascript.
Ive seen some examples using opacity and filters in styles but they dont seem to work for me.



Thanks in advance



CP


More From » css

 Answers
0

[UPDATE]



A pure CSS solution would be to use CSS filters:



img:hover {
filter: brightness(1.5);
}


Here we add 50% brightness to all images on hover.






Why not? You can always set the background of the parent container to #fff (white) and then lower the opacity of the image.



HTML:



<div class=white>
<img src=image.jpg alt=Image />
</div>


CSS:



.white { background: #fff; }
img:hover {
opacity: 0.5;
filter: alpha(opacity=50);
}


Another solution is to use a JavaScript library, such as Pixastic.


[#97070] Monday, April 12, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eanskylerg

Total Points: 524
Total Questions: 107
Total Answers: 100

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
;