Created
May 26, 2011 11:48
-
-
Save itsjavi/992982 to your computer and use it in GitHub Desktop.
Initialize jQuery UI widgets and behaviours using HTML5 declarative markup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
$(document).ready(function(){ | |
$("*[data-ui-widget]").each(function(){ | |
$this = $(this); | |
switch($this.data("ui-widget")){ | |
case "button":{ | |
$this.button($this.data("ui-widget-options")); | |
}break; | |
case "datepicker":{ | |
$this.datepicker($this.data("ui-widget-options")); | |
}break; | |
case "slider":{ | |
$this.slider($this.data("ui-widget-options")); | |
}break; | |
case "accordion":{ | |
$this.accordion($this.data("ui-widget-options")); | |
}break; | |
case "tabs":{ | |
$this.tabs($this.data("ui-widget-options")); | |
}break; | |
case "autocomplete":{ | |
$this.autocomplete($this.data("ui-widget-options")); | |
}break; | |
case "progressbar":{ | |
$this.progressbar($this.data("ui-widget-options")); | |
}break; | |
case "dialog":{ | |
$this.dialog($this.data("ui-widget-options")); | |
}break; | |
} | |
}); | |
$("*[data-ui-behaviour]").each(function(){ | |
$this = $(this); | |
switch($this.data("ui-behaviour")){ | |
case "draggable":{ | |
$this.draggable($this.data("ui-behaviour-options")); | |
}break; | |
case "droppable":{ | |
$this.droppable($this.data("ui-behaviour-options")); | |
}break; | |
case "resizable":{ | |
$this.resizable($this.data("ui-behaviour-options")); | |
}break; | |
case "selectable":{ | |
$this.selectable($this.data("ui-behaviour-options")); | |
}break; | |
case "sortable":{ | |
$this.sortable($this.data("ui-behaviour-options")); | |
}break; | |
} | |
}); | |
}); | |
return true; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment