- 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.
$(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
});
});
$('.sampleElementToInitialize').initialize({
init : true
});
- 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