5
Contributors
4
Replies
7
Views
7 Years
Discussion Span
Last Post by codejoust
0

If you want fading effects for various elements on an html page then the jQuery javascript library is for you. The following example fades out and then fades back in all divs on a page that are clicked.

<html>
	<head>
    		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript">
        	$(function(){
            		$("div").click(function() {
                		$("div").fadeOut("slow", function() {
                    		$("div").fadeIn("slow");
                		});
            		});
        	});
        	</script>
	</head>

	<body>
		<div style="width: 400px; height: 400px; background: #CC0000; border: #000000"></div>
	</body>
</html>

Here's the javascript bit on it's own:

$(function(){
            $("div").click(function() {
                $("div").fadeOut("slow", function() {
                    $("div").fadeIn("slow");
                });
            });
        });
0

Of course it would help to know more precisely what your doing but in lieu of that there are some CSS3 things that will help specifically the new 'opacity' property.

However you will need to create several versions (one for each browser) because CSS3 is not properly out yet.
A cascading try/catch system should do the trick.

Or you could just use Jquery (I like to code everything myself then I know where I am with it).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.