| | |
html to make images different fade in and out
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
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
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxexample ajaxjspservlets array blackjack browser captcha captchaformproblem cart child close codes css date debugger decimal dependent design developer disablefirebug dom element embed engine enter error events ext file firefox flash focus form forms frameworks game getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe index java javascript javascripthelp2020 jquery jsp jump libcurl listbox maps marquee masterpage math media menu mp4 onerror onmouseoutdivproblem onmouseover onreadystatechange parameters paypal pdf php position post problem programming prototype rated rating redirect safari scale scriptlets scroll search security size software star starrating stretch synchronous toggle tweet unicode variables w3c web webservice window \n





