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

  • SEARCH
  • Home
  • 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 7979469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:47:21+00:00 2026-06-04T09:47:21+00:00

i am using jquery addClass and removeClass function here is code <script> $(document).ready(function() {

  • 0

i am using jquery addClass and removeClass function

here is code

<script>
$(document).ready(function() {
    abc();

    function abc() {

        res=randomXToY(1,15,0);
            $('#img' + res).addClass('activeImg');
            setTimeout(function() {removeClassImg(res) },3000);
    }
    function removeClassImg(res) {

            $('#img' + res).removeClass('activeImg');
            abc();

    }
    function randomXToY(minVal,maxVal,floatVal)
    {
        var randVal = minVal+(Math.random()*(maxVal-minVal));
        return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);
    }
});
</script>

and css is

.activeImg{
    opacity:1 !important;
}

This is working perfect. but now i want to add fadein and Fadeout effects for this..

I dont have idea how to add Fadein effect to addClass activeimg and fadeout effect in remove class.

Anybody have idea about this

Thanks

  • 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-06-04T09:47:22+00:00Added an answer on June 4, 2026 at 9:47 am

    Try

    $('#img' + res).fadeOut().removeClass('activeImg');
    

    and similarly

    $('#img' + res).fadeIn().addClass('activeImg');
    

    Is there any specific reason you’re using !important? That might override the JQuery from perfoming its effects to your element, so take it off if you can.

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

Sidebar

Related Questions

I am using jquery addClass code to show/hide elements when rolling over a div.
Using jQuery I want to bind an existing function to a button. I've been
Using jQuery UI 1.8rc3 combined with the new jquery.effects.fade.js code, I've been able to
How do I send a javascript variable to a subsequent jquery function? Here is
I'm using jCarousel Lite plugin in an AJAX loaded content: here's the (semplified) code
Here is my problem: The Problem I have created Tabs using jQuery which is
Im trying to use a Web Service to set an Airport code using Jquery
I am using facebox which uses jQuery 1.2.1 on my website here http://www.pointclickshoot.com/beta2 The
While writing an add to favorites-function using AJAX and certain other jQuery functions like
I'm using this tickertype jquery plugin: http://www.hungry-media.com/code/jQuery/tickerType/ And I'm trying to attach a hover

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.