elements • IniIalize component for one or many Dom elements <div class=“el-‐one”></div> <div class=“el-‐two”></div> – $(“.el-‐one, .el-‐two”).colorize();
Enable Methods by querying the DOM $(DOM).component(method_name, params, callbackFunc); $(“.el-‐one, .el-‐two”).colorize(“changeColor”,”red”, funcIon(){ // Code goes here });
want to be Orange. Plzz… </div> <div class=“colorize”> What is my color ?! </div> <script> $(“.colorize”).colorize({ color: “green” }); $.fn.colorize.se`ngs = { color: “purple”; }; </script>
//old $.fn.carousel = funcIon(){}; //new (newly created component ) $.fn.carousel = funcIon(){}; $.fn.carousel.noConflict(); // falling back to the old One. $(“.el”).carousel();
jQuery library to easily create smart extensible UI Components ( 0.7 Kb ) • Support Data abribute to override config parameters • Easily expose public methods for you components • Avoiding overwriIng exisIng components by using noConflict • SupporIng JavaScript OOP principles by using Prototypes • More importantly provides code consistency, simplicity and faster execuIon for wriIng UI Components.