jquery

Jquery是继prototype之后又一个优秀的Javascrīpt框架。它是轻量级的js库(压缩后只有21k) ,它兼容CSS3,还兼容各种浏览器 (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)。jQuery使用户能更方便地处理HTML documents、events、实现动画效果,并且方便地为网站提供AJAX交互。jQuery还有一个比较大的优势是,它的文档说明很全,而且各种应用也说得很详细,同时还有许多成熟的插件可供选择。jQuery能够使用户的html页保持代码和html内容分离,也就是说,不用再在html里面插入一堆js来调用命令了,只需定义id即可。

可以用jquery自己的方法控制页面里的元素,内容,css,ajax,淡入淡出效果。

这里 有很好的例子!

http://jqueryui.com/themeroller/ provides: accordion, slider, tab, dialog, datepicker, progressbar

 

  1. $(‘#xxx’, ‘.xxx’, ‘xxx’) for id, class, label.
  2. :contains(), :even, :odd,   for froms: :text, :radio,  :nth-child(number or odd)  :eq(number)
  3. .parent, .children, .addClass, .next, .nextAll, .andself, .filter.
  4. good to add css before js within <head>
  5. jQuery.noConfflict(); for other library, use jQuery to replace $.
  6. two different sequence:1,bubble(jQuery) specific first, 2.capture.
  7. event.target or event.stopPropagation() for specific.
  8. is() or hasClass
  9. parentheses would  cause function be called, not referenced.
  10. trigger(‘ ‘) to simulate user action
  11. $(‘HTML’) to build DOM tree  (insertAfter(), after(), prependTo()用于加元素在某元素前或者后)
  12. attr(‘id’, ‘xxx index’) in each(function(index){index add 1 by 1}) 用于生成sequence id
  13. wrap() 加div在外, copy() copy element.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s