| | |
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 animate api array automatically beta box bug calendar captcha cart codes column cookies createrange() css cursor date debugger decimal design developer dom download dropdown element embed enter error events firefox firehose focus form frameworks getselection google gwt hint html htmlform ie7 iframe image() images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsp listbox maps marquee masterpage menu microsoft mimic mp4 onmouseover paypal php player position post problem programming progressbar prototype rating redirect regex runtime safari scale scriptlets search select sql starrating text textarea toggle tweet twitter validation variables w3c webservice website window windowofwords windowsxp xml





