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 6800181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:56:17+00:00 2026-05-26T18:56:17+00:00

I am working on new website and I got question. Should I change style

  • 0

I am working on new website and I got question.
Should I change style using class or javascript code, for example:

the class way:

$('.class').hover(function()
{
    $(this).addClass('nameofclass');
},function()
{
    $(this).removeClass('nameofclass');
}

the javascript way:

$('.class').hover(function()
{
    $(this).css('property','value');
},function()
{
    $(this).css('property','value');
}

same question about animate, but in order to use class in animate, I need to use plugin. should I use plugin to allow class animation?

  • 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-26T18:56:18+00:00Added an answer on May 26, 2026 at 6:56 pm

    Change the class, then the style is set in the CSS, and the behaviour is in the JS.

    This also has the advantage that you can use CSS transitions in browsers that support them, while using animate in old ones, by adding the transition property where needed, then using css instead of animate in jQuery in new browsers.

    For instance, say you want to fade out a div:

    CSS

    .fade {
        opacity:0;
    }
    
    .box {
        width:100px;
        height:100px;
        background-color:red;
        -webkit-transition:all ease-in-out 0.6s;
        -moz-transition:all ease-in-out 0.6s;
        -ms-transition:all ease-in-out 0.6s;
        -o-transition:all ease-in-out 0.6s;
        transition:all ease-in-out 0.6s;
    }
    

    HTML

    <div class="box"></div>
    

    Your javascript can then look like this:

    JS

    $(document).ready(function() {
        $(".box").click(function(){
             $(this).toggleClass("fade");
        });
    });
    

    In non transition browsers, you just won’t get a fade. To add that, you can use animate to animate to the properties.

    For more info on transitions, have a look at http://css3.bradshawenterprises.com/.

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

Sidebar

Related Questions

I'm working on a classified listing style website and I'm pretty new to Rails...
I just got a new job working for a website and I am trying
I appreciate your help one of the features working on for my new website!
I am relatively new to website design and specifically working in ASP.NET, i am
I'm testing the new template for a website that I'm working for, and on
Working on a new app and using restful-authentication. I was trying to make it
I'm new to using CURL, but I have successfully got it to submit ordinary
I am new here and got a question that is tricking me all day
I'm new in php, now I'm working on a website in which there is
We are working on a new web site using Apache, Python and Django. In

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.