DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   html to make images different fade in and out (http://www.daniweb.com/forums/thread201339.html)

postal07 Jul 2nd, 2009 6:43 pm
html to make images different fade in and out
 
I have been trying this also and can,t get it to work thought i had the right code.Please help

Bojero Jul 3rd, 2009 4:22 am
Re: html to make images different fade in and out
 
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");
                });
            });
        });

MattTheHat Jul 3rd, 2009 6:35 am
Re: html to make images different fade in and out
 
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).

rangminank Jul 3rd, 2009 5:00 pm
Re: html to make images different fade in and out
 
Thanks for u info...
i think i can use it for my picture somedays....


<FAKE SIGNATURE>

codejoust Jul 4th, 2009 1:58 pm
Re: html to make images different fade in and out
 
Actually, look at the innerfade library for jQuery for out-of the box functionality...
http://medienfreunde.com/lab/innerfade/

Cheering You Up!


All times are GMT -4. The time now is 4:33 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC