-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
62 lines (53 loc) · 1.34 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
A library for scope declaration like activerecord 3.
It can be used for declare scopes and behaviors that can be attached to dom object.
Some examples:
append style css to dom objects
```
$.fn.declare.add({
'set.color': function(color) {
return this.css({
'color': color
});
},
'set.bgcolor': function(color) {
return this.css({
'background-color': color
});
}
});
$("div.title").declare('set.color', 'yellow').declare('set.bgcolor', 'red');
```
append events e style to table
```
$.fn.declare.add({
'row.alternate': function(opt) {
this.find("tr.odd")
.css("background-color",opt.odd_color)
.end()
.find("tr.even")
.css("background-color",opt.even_color);
}
});
$.fn.declare.add({
'row.hover':function(color_hover) {
this.hover(
function() {
var that=$(this);
that.data("old-bg",that.css("background-color"));
that.css("background-color",color_hover);
},
function() {
var that=$(this);
that.css("background-color", that.data("old-bg"));
}
)
}
});
$("table")
.declare('row.alternate',{
odd_color:'#ff0000',
even_color:'#00ff00'
})
.find("tr")
.declare("row.hover","#0000ff");
```