/jquery.initialize

A Simple Element Initializer Context Plugin for jQuery.

Primary LanguageHTMLMIT LicenseMIT

jquery.initialize 1.4.0

Go to jQuery Initialize Wiki

  • Latest update done up to 1.4.0 : added sub elements data binding.
  • Latest update done up to 1.3.0 : data properties, template property and string template replacing.

A simple element initializer context plugin for jQuery. This plugin makes an element initialize and attach for defined events with their names and datas into their own string templates.

usage with (Modern Browsers)

$(document).ready(function () {
        
  $('#header').initialize({
    elements : [
      {
        name : '#subElement1',
        events : [
          {
            name : 'click',
            fn : function (e) {
              console.log('clicked first sub element...');
            }
          }
        ]
      },
      {
        name : '#subElement2',
        events : [
          {
            name : 'click',
            fn : function (e) {
              console.log('clicked second sub element...');
            }
          }
        ]
      }
    ],
    data : ['header','this is a header container.', (function() { return 'this is the third parameter for header.'})()],
    template : '{0} - {1} - {2}',
    events : [
      {
        name : 'click',
        fn : function () {
          console.log('clicked header...');
        }
      },
      {
        name : 'dblclick',
        fn : function () {
          console.log('double-clicked header...');
        }
      },
      {
        name : 'mouseover',
        fn : function () {
          console.log('mouse-hovered header...');
        }
      }
    ],
    methods : {
      log : function(message) {
        console.log(message);
      }
    },
    init : true //this can be false if you expect the element not injected into DOM
  });

});

usage with class names (Modern Browsers)

  $('.sampleElementToInitialize').initialize({
    init : true
  });

events list in javascript api to use with jquery.initialize

  • abort
  • activate
  • afterprint
  • beforeactivate
  • beforecopy
  • beforecut
  • beforedeactivate
  • beforepaste
  • beforeunload
  • blur
  • beforeupdate
  • bounce
  • challange
  • change
  • copy
  • cut
  • dblclick
  • drag
  • dragdop
  • dragend
  • dragenter
  • dragexit
  • draggesture
  • dragleave
  • dragover
  • dragstart
  • drop
  • error
  • finish
  • focus
  • focusin
  • focusout
  • hashchange
  • help
  • input
  • keydown
  • keypress
  • keyup
  • load
  • message
  • mousedown
  • mouseenter
  • mouseleave
  • mousemove
  • mouseout
  • mouseover
  • mouseup
  • mousewheel
  • offline
  • online
  • overflowchanged
  • paste
  • RadioStateChange
  • readystatechange
  • reset
  • resize
  • scroll
  • search
  • select
  • selectionchange
  • selectstart
  • start
  • stop
  • submit
  • textInput
  • underflow
  • unload