473,383 Members | 1,855 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Swap display action with fade effect

Hi there first posting, I'm also no programmer myself so please be gentle
I´m not to confortable on terminology so I'll post the code to simplier discribe my question

I would like some help, to add a fade transition to this swap action onclick, is it possible to do?

Here's the code I'm using, everything is working fine, I just want to add this effect. I'm using jQuery library.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">        
  2.         function swapDisplay(action)
  3.         {
  4.             if(action)
  5.             {
  6.                 $('.thumbstyle img').css({"opacity": 0});
  7.  
  8.                 $('.thumbstyle img').hover(function() {
  9.                     $(this).stop().animate({ "opacity": 1 }, 'fast');
  10.                 }, function() {
  11.                     $(this).stop().animate({ "opacity": 0 }, 'fast');
  12.                 });
  13.             }
  14.             else
  15.             {
  16.                 $('.thumbstyle img').css({"opacity": 1});
  17.  
  18.                 $('.thumbstyle img').hover(function() {
  19.                     $(this).stop().animate({ "opacity": 0 }, 'fast');
  20.                 }, function() {
  21.                     $(this).stop().animate({ "opacity": 1 }, 'fast');
  22.                 });
  23.             }
  24.             $('#changeview').html('<a href="javascript:void(0)" onclick="swapDisplay(' + (!action) + ')"><img src="_imagens/separador1.jpg" alt="mudar vista" /></a>');
  25.         }
  26.   </script>
  27. </head>
  28. <body onload="swapDisplay(false)">
  29. <div id="loading"><img src="_imagens/loader.gif" width="19" height="4" alt="loading..." /></div>
  30. <div id="container" style="display: none;">
  31. <a name="top" id="top"></a>
  32.    <div id="content">
  33.      <p id="changeview"><a href="javascript:void(0)" onclick="swapDisplay(false)"><img src="_imagens/separador1.jpg" width="19" height="17" /></a></p>
  34.       </div>
Thanks in advance
Regards
Jan 11 '11 #1
2 2015
dlite922
1,584 Expert 1GB
Can you describe the problem more in detail? Where are you getting stuck in the code?

DM
Jan 17 '11 #2
Hi thanks for your reply.

The code above is working fine, I'm having trouble in making the image swap display work with a fade effect, when the change view button is clicked.
Hope i'm being clear enough.

This is the part of the code i'm refering to, the complete code is on the first post.


Expand|Select|Wrap|Line Numbers
  1. $('#changeview').html('<a href="javascript:void(0)" onclick="swapDisplay(' + (!action) + ')"><img src="_imagens/separador1.jpg" alt="mudar vista" /></a>');
Expand|Select|Wrap|Line Numbers
  1. <p id="changeview"><a href="javascript:void(0)" onclick="swapDisplay(false)"><img src="_imagens/separador1.jpg" width="19" height="17" /></a></p>
Thanks in advance
Jan 18 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Acer | last post by:
Hi, Can somebody help me to create a php function which show an image, fade-out to another images ? thx
2
by: Susanna | last post by:
Hi all, I'm using the following slideshow script that I found on the web to display changing images with a crossfade effect. Eventually I will be adding many more images to the slideshow. The...
1
by: Acer | last post by:
Does somebody know a javascript function to show an image and fade-out to another picture ? thanks for any help
4
by: Chris Lieb | last post by:
Hi, I am writing a class in JavaScript to cause a repeating fade effect. The fade class takes care of the fading and the rgb class takes care of manipulating rgb values: function rgb(red,...
0
by: tristanlbailey | last post by:
I have been attempting to solve this problem for a few weeks now, but I'm not having much luck... I would like to create a seamless fading effect on each form/window in my program; one that, when...
2
Ali Rizwan
by: Ali Rizwan | last post by:
Hi all, I made a usercontrol and want to give fade effects to it. Now problem is that i m using alpha command as i use in my cool form. Nothing is happninig. How can i give fade effect to a...
1
by: Maximiliano | last post by:
Is there any way to handle a fade effect like script.aculo.us but on the server side?. I mean a call a fade effect and i want to know when it finished to raise another server method? I need this...
4
by: pt36 | last post by:
Hi I have a small script function photo(a){ var photo = a ; document.getElementById(photoID).innerHTML = photo; } and on the body
2
by: ilija | last post by:
Hello! As I am not much familiar with javascript (I know the basics of basics), I cannot find any script that would satisfy my needs. What I want is something like this:...
4
Tj Jurado
by: Tj Jurado | last post by:
Hi guys, I am new to this and need a little help. I have an html block to be rotated and placed in an array via php as well as printed as an xml format then. Without refreshing the page, the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.