| | |
html to make images different fade in and out
![]() |
•
•
Join Date: Jul 2009
Posts: 13
Reputation:
Solved Threads: 3
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.
Here's the javascript bit on it's own:
html Syntax (Toggle Plain Text)
<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:
javascript Syntax (Toggle Plain Text)
$(function(){ $("div").click(function() { $("div").fadeOut("slow", function() { $("div").fadeIn("slow"); }); }); });
Last edited by Bojero; Jul 3rd, 2009 at 4:25 am.
•
•
Join Date: May 2009
Posts: 10
Reputation:
Solved Threads: 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).
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).
Actually, look at the innerfade library for jQuery for out-of the box functionality...
http://medienfreunde.com/lab/innerfade/
Cheering You Up!
http://medienfreunde.com/lab/innerfade/
Cheering You Up!
![]() |
Similar Threads
- images & style not displaying in EXpressin Web2 (HTML and CSS)
- How to make a newsletter (ASP)
- Problem with uploading images to website (PHP)
- fading images in photoshop (Graphics and Multimedia)
- Building a HTML photo album (HTML and CSS)
- Firefox leaves space with images (HTML and CSS)
- saving .html to .doc not showing any images (HTML and CSS)
- Creating a disk image (OS X)
- Adding Content to image based web pages? (Site Layout and Usability)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: How to prevent Javascript Menu from getting hidden under Flash Video (SWFObject ).
- Next Thread: open exe file direct on web page by link
Views: 8294 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ad ajax ajaxcode ajaxhelp alignment animate api array automatically box browser bug calendar calling checkbox child class content cookies createrange() css cursor div dom dropdown editor element events explorer file firehose flash form forms function google html htmlform ie8 iframe image() images insertbefore internet java javascript jawascriptruntimeerror jquery jsf jsfile jsp jump list load maps math matrixcaptcha microsoft mp3 mysql object objects offline onmouseoutdivproblem onreadystatechange parent passing php player post progressbar refresh regex resize runtime script scrubber search select selection session shopping size sql star stars stretch text textarea twitter validation values variables web website window windowsxp wysiwyg xspf \n





