25 советов и подсказок по jQuery

20 Дек 2008  |  Автор: Agito  |  Рубрика: JavaScript

25 советов и подсказок по jQuery от Джона Хоббс-Смита:

  •  Load the framework from Google Code
  • Use a cheat sheet
  • Combine all your scripts and minify them
  • Use Firebug’s excellent console logging facilities
  • Keep selection operations to a minimum by caching
  • Keep DOM manipulation to a minimum
  • Wrap everything in a single element when doing any kind of DOM insertion
  • Use IDs instead of classes wherever possible
  • Give your selectors a context
  • Use chaining properly
  • Learn to use animate properly
  • Learn about event delegation
  • Use classes to store state
  • Even better, use jQuery’s internal data() method to store state
  • Write your own selectors
  • Streamline your HTML and modify it once the page has loaded
  • Lazy load content for speed and SEO benefits
  • Use jQuery’s utility functions
  • Use noconflict to rename the jquery object when using other frameworks
  • How to tell when images have loaded
  • Always use the latest version
  • How to check if an element exists
  • Add a JS class to your HTML attribute
  • Return ‘false’ to prevent default behaviour
  • Shorthand for the ready event

Примеры использования.

Один комментарий | Нам важно ваше мнение!

  1. GROM  |  30 Янв 2009 в 10:12 #

    Пусть и не скромно начинать комментарий с комплимента, но у Вас достаточно приятно побывать в гостях. Пишите Вы, как я вижу, не очень быстро, но с другой стороны, это ведь тоже не плохо. ИМХО это лучше, чем писать всякую ерунду или просто копировать свои тексты с чьих-либо лент. А вот насчет комментариев, тут да, у Вас иногда такие дискуссии разгораются, что прямо даже удивительно. На ровном месте. Еще зайду как-нибудь.

    GROM - Gravatar

Ваш отзыв

XHTML: Вы можете использовать следующие теги: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

голодные игры смотреть