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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:44:20+00:00 2026-05-31T12:44:20+00:00

I am animating the reduction of a <section> ‘s width from a fluid .span12

  • 0

I am animating the reduction of a <section>‘s width from a fluid .span12 to match the width of .span3.
How I’m currently doing it is:

$('#searchPanel').animate({width: '23.404255317%'}, 400);
$('#searchPanel').removeClass('span12');
$('#searchPanel').addClass('span3');

Problem is, the width set in the animation is overriding the .span3 class. Which is messing up some responsive stuff I have going on.

How do I get rid of that width after animating it? I know that jquery ui has .switchclass but I’m thinking I’m just doing this in a dumb way and should know how to do things like this…

Thank you!

Update:
It might not be the best solution, but I got it to work by adding a callback and removing the ‘Style’ Attribute:

$('#searchPanel').animate({width: '23.404255317%'}, 400, 'swing', function () {
    $(this).removeAttr('style').removeClass('span12').addClass('span3');
 } );
  • 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-31T12:44:21+00:00Added an answer on May 31, 2026 at 12:44 pm

    Have you tried

    $('#searchPanel')
    .animate({width: '23.404255317%'}, 400)
    .removeClass('span12')
    .addClass('span3')
    .removeAttr('width');
    

    Also, remember to search only once for the element $(‘#searchPanel”) and then chain the others methods.

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

Sidebar

Related Questions

I'm animating a rectangle in jQuery to go from width:0px, heihgt:0px; to width:564px; height:264px;
I am having trouble animating a custom UITableView section header. The goal was to
I m un-animating a list using this code... function unanimate_li() { $li.filter(':last') .animate({ height:
I'm animating a an ImageView from the left to the right of the screen
I am animating an image from the exact center to a specific position in
I am animating 3 images (sprites) from off screen to the right into the
I'm having problems animating my button in my scrollview. Basically what I'm doing is
I am animating the background image of a div using jQuery .animate(), but sometimes
When animating a width toggle, it's not animating the padding, so i looked into
I'm animating a pendulum which swings from 0 degrees to max 200 degrees and

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.