Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<div id="box" style="background-color: rgba(255, 255, 255, 0.4)">Picture and label</div>



Now , When I came on, I want to change the value of transparency.

Thanks.
Posted
Comments
Sandeep Mewara 19-Apr-12 13:03pm    
Not clear. You talking of on-hover event?

1 solution

If you use jQuery, it can be very easy:


HTML
<html>

<head>
	<title>Test</title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script>
		$(function() {
			$('#box').hover(function (e) {
				$(this).fadeTo('slow', 1.0);
			}, function (e) {
				$(this).fadeTo('slow', 0.4);
			});
		});
	</script>
</head>

<body>
     <div id="box" style="background-color: rgba(0, 0, 0, 0.4)">Picture and label</div>
</body>
</html>
 
Share this answer
 
Comments
kozmikadam 19-Apr-12 13:16pm    
Thanks !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900