Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Which is better practice…

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #44260
    Rugg
    Participant

    Hi,

    I’m curious if there is a preferred method for writing the following jQuery animation syntax.

    **Method One**

    $(‘.box’).animate({ left: -20 }, 400, ‘linear’);

    **Method Two** (pixels defined)

    $(‘.box’).animate({ left: “-20px” }, 400, ‘linear’);

    Also…is there a difference in single and double quotes? For example, **”-20px”** and **’-20px’**

    Thanks for any suggestions

    #132483
    SgtLegend
    Member

    There is no difference between using `”` and `’`, people say there is but I have never seen anything to suggest either one is slower or faster than the other.

    As for the animation syntax you can generally just leave off the `px` and use integers as jQuery defaults everything to a pixel value anyway.

    #132523
    TheDoc
    Member

    I prefer using direct numbers over defining the value as px.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.