Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6195271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:26:26+00:00 2026-05-24T03:26:26+00:00

I need some jquery help. I have a simple image gallery and I’d like

  • 0

I need some jquery help. I have a simple image gallery and I’d like to add some jquery effect (particulary fading in/out of the images in #actimg). Keep in mind, Im not very familiar with jquery.

js

<script type="text/javascript">
function showPic (whichpic) {
  if (document.getElementById) {
  document.getElementById('actimg').src = whichpic.href; 
  return false; 
 } else {
  return true;
 } 
}
</script>

and body

<ul>
<li><a onclick="return showPic(this)" href="images/girl_01.jpg"><img height="50px" width="50px" src="images/girl_01.jpg" /></a></li>
<li><a onclick="return showPic(this)" href="images/girl_02.jpg"><img height="50px" width="50px" src="images/girl_02.jpg" /></a></li>
<li><a onclick="return showPic(this)" href="images/girl_03.jpg"><img height="50px" width="50px" src="images/girl_03.jpg" /></a></li>
</ul>

<img id="actimg" src="images/girl_04.jpg" alt="" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:26:28+00:00Added an answer on May 24, 2026 at 3:26 am
    function showPic (whichpic) {
      if (document.getElementById) {
      $('#actimg').fadeOut('slow');
      document.getElementById('actimg').src = whichpic.href; 
      $('#actimg').fadeIn('slow');
      return false; 
     } else {
      return true;
     } 
    }
    

    I have added two lines around the line where you change the source of the #actimg img tag. The one just before fades the #actimg out and the one just after fades it back in.

    —- EDIT —-

    change:

      $('#actimg').fadeOut('slow');
      document.getElementById('actimg').src = whichpic.href; 
      $('#actimg').fadeIn('slow');
    

    to:

      $('#actimg').fadeOut(250);
      setTimeout(function() {
          document.getElementById('actimg').src = whichpic.href; 
          $('#actimg').fadeIn(250);
      }, 250);
    

    This will fadeOut the #actimg element, then it will change the source of that element and fadeIn the element. Note that the fadeOut duration should be the same or less than the duration of the timeout so that the fade can complete before the source of the image is changed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with jQuery for the first time and need some help. I have
I have one jQuery code and need some help from u guys to improve
I'm not really good at Javascript/jQuery yet, so I need some help. I have
I need some help with jQuery script again :-) Just trying to play with
I use a jquery validation plugin and I need to add some extra checking,
Need some help about with Memcache. I have created a class and want to
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
Need some help to solve this. I have a gridview and inside the gridview
I am new to jQuery and need some help with the following problem. I
I'm working on a simple game and I need some help to improve my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.