943,520 Members | Top Members by Rank

Ad:
Jul 2nd, 2009
0

html to make images different fade in and out

Expand Post »
I have been trying this also and can,t get it to work thought i had the right code.Please help
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
postal07 is offline Offline
2 posts
since Jun 2009
Jul 3rd, 2009
0

Re: html to make images different fade in and out

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.

html Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script type="text/javascript" src="jquery.js"></script>
  4. <script type="text/javascript">
  5. $(function(){
  6. $("div").click(function() {
  7. $("div").fadeOut("slow", function() {
  8. $("div").fadeIn("slow");
  9. });
  10. });
  11. });
  12. </script>
  13. </head>
  14.  
  15. <body>
  16. <div style="width: 400px; height: 400px; background: #CC0000; border: #000000"></div>
  17. </body>
  18. </html>

Here's the javascript bit on it's own:

javascript Syntax (Toggle Plain Text)
  1. $(function(){
  2. $("div").click(function() {
  3. $("div").fadeOut("slow", function() {
  4. $("div").fadeIn("slow");
  5. });
  6. });
  7. });
Last edited by Bojero; Jul 3rd, 2009 at 4:25 am.
Reputation Points: 10
Solved Threads: 3
Newbie Poster
Bojero is offline Offline
13 posts
since Jul 2009
Jul 3rd, 2009
0

Re: html to make images different fade in and out

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).
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MattTheHat is offline Offline
10 posts
since May 2009
Jul 3rd, 2009
0

Re: html to make images different fade in and out

Thanks for u info...
i think i can use it for my picture somedays....


<FAKE SIGNATURE>
Last edited by peter_budo; Jul 4th, 2009 at 6:07 am. Reason: Keep It On The Site - Do not manually post "fake" signatures in your posts. Instead, you may create a sitewide signature within the user control panel.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rangminank is offline Offline
3 posts
since Jul 2009
Jul 4th, 2009
0

Re: html to make images different fade in and out

Actually, look at the innerfade library for jQuery for out-of the box functionality...
http://medienfreunde.com/lab/innerfade/

Cheering You Up!
Reputation Points: 18
Solved Threads: 21
Junior Poster
codejoust is offline Offline
180 posts
since Jul 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: How to prevent Javascript Menu from getting hidden under Flash Video (SWFObject ).
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: open exe file direct on web page by link





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC