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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:45:55+00:00 2026-06-17T01:45:55+00:00

I couldn’t figure out How to set time on jQuery .css property I found

  • 0

I couldn’t figure out How to set time on jQuery .css property

I found one answer which is the closest to my question in
jQuery change CSS after a certain amount of time

Here is my code:

<script>
    $(document).ready(function(){
        $("#homebutton,#title").click(function(){
            $("#title").css("font-size", "100%");  
            setTimeout(function(){ $("#title").css("font-size", "100%"); },2000)
        });
    });
</script>

I don’t know what is wrong with that.

It seems like the solution I mentioned above doesn’t work for me.

Thank you in advance guys

—————————————–EDIT———————————————-

Thanks for the response folks, there are several things that I want to re-explain:

  1. I initially set the font-size to 150% in my CSS, which mean through my jQuery, I expected it to change the font-size into 100%.
  2. I think I’ve misinterpreted the code, what I wanted to set is the time for decreasing gradually and not the timer

Basically, I want to change the font-size using jquery with transition, and not a sudden change

  • 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-17T01:45:56+00:00Added an answer on June 17, 2026 at 1:45 am

    The trouble is you first set font-size: 100% immediately, then you set it to the same value again after 2 seconds. Ie, you aren’t changing the css.

    To set the css value when clicked, and then set it to something else 2 seconds later, use different values in each call to .css(). Eg, to decrease the font size by half initially, then bring it back to normal size 2 seconds later:

    $(document).ready(function(){
        $("#homebutton,#title").click(function(){
            $("#title").css("font-size", "50%");
            setTimeout(function(){ $("#title").css("font-size", "100%"); },2000);
        });
    });
    

    Edit: To gradually decrease the font size, you want to use .animate():

    $(document).ready(function(){
        $("#homebutton,#title").click(function(){
            $("#title").animate({ "font-size": "50%" }, 2000);
        });
    });
    

    Demo: jsfiddle.net/Y6CrG/

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

Sidebar

Related Questions

Couldn't figure out how to word the question accurately, so here's an example: Given
Couldn't comment on this post, which states the problem I'm experiencing: jQuery remove() on
I couldn't find a straight answer to my question and need to know it
I couldn't figure out how to optimize this query and I didn't find a
Couldn't find an answer to this question. It must be obvious, but still. I
I couldn't find the answer to this question in SO. I'll try to explain.
I couldn't find any question similar to this one, I wanted to know about
I couldn't figure out why this happens after stumbling around Michael Hartl tutorial. When
Couldn't find an answer to this solution, so once I figured it out I
Couldn't seem to find the answer to this question - what is the haml

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.