| | |
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 |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child close column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms google gwt gxt hiddenvalue highlightedword hint html htmlform ie8 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl listbox math media microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player post problem progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





