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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:00:25+00:00 2026-05-26T21:00:25+00:00

I have a question for the jQuery experts. I am trying to set a

  • 0

I have a question for the jQuery experts. I am trying to set a margin-left on a sliding div in a slider im making.

Is it faster for DOM Traversal and CSS rendering to do:

Insert inline css via .css('margin-left','-690px');

OR

Create a new css Class and insert it .addClass('marginLeftClass');

Does one have a potential advantage over another?

  • 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-26T21:00:26+00:00Added an answer on May 26, 2026 at 9:00 pm

    Adding the styles via .addClass is faster as the styles are already loaded.

    By using .CSS() in jQuery you are injecting the values and making the element adapt to new CSS on the fly.

    Its probably easier to think about it in larger terms, would you rather inject 10 seperate css properties on the fly via jQuery CSS properties, or just simply toggle a class? It’s easier to add the class, and MUCH easier to manage.

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

Sidebar

Related Questions

I have a question about some functionality I'm trying to add to my jQuery
I have a simple jQuery question. How come I can't do this? $(<div class='flora'></div>).insertBefore('</body>');
I have a Fundamental question in using Jquery with PHP when making ajax calls
A jquery question. I have a div that contains text and an anchor tag.
An easy jQuery question. I have several identical forms ( except their name )
Really quick jQuery question... I have this function: $(document).ready(function() { $('a#show1').click(function() { $('.item1').toggle(1000); return
Another jQuery question for you guys. Say I have a url of an image
I have this question: How could I call a codebehind method from jquery? I
Again I have a question regarding this plugin: http://t.wits.sg/2008/06/20/jquery-progress-bar-11/ What I want to achieve
Okay guys, I have read through all the other posts and question on jQuery

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.