| | |
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 |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug captchaformproblem checkbox close codes createrange() css cursor debugger dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp jump listbox maps masterpage math media menu microsoft mp4 object onmouseoutdivproblem onreadystatechange paypal pdf php player position problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select size software sql text textarea unicode w3c window windowofwords windowsxp wysiwyg \n





