jQuery UI 在线

843jQuery UI 部件库

Web Widget [ˈwɪdʒɪt]

中文译名被称作是微件

是一小块可以在任意一个基于HTML的Web页面上执行的代码

表现形式可能是视频,地图,新闻,小游戏等等

根本思想来源于代码复用

Widget的代码形式包含了DHTML,JavaScript

及Adobe Flash

842jQuery UI 实例 – 放置(Droppable)

Dialog Widget

Description: Open content in an interactive overlay.

http://api.jqueryui.com/dialog/#option-buttons

841jQuery UI 实例 – 放置(Droppable)

$("#dialog-form").dialog({

// .....

buttons: {

  'save': function() {

      var $this = $(this);

                // -this- is still the original context// of $("#dialog-form")

      $.post({

         /// ...

         $this.dialog("close"); // <-- used here

      });

  }       

}

});

840jQuery UI 实例 – 放置(Droppable)

$modal.dialog( "open" ); jquery uicannot call methods on dialog prior to initialization; attempted to call method 'open'

/// chang code to below //

$("#dialog-modal").dialog({ buttons: [ { text: "Ok",icons: {primary: "ui-icon-heart"},click: function() {$( this ).dialog( "close" );} } ] });