| 2 |
lars |
1 |
dojo.require("dijit.dijit");
|
|
|
2 |
dojo.require("dojo.fx");
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
var animationMethod = "combine"; // chain || combine
|
|
|
6 |
var _showing = false;
|
|
|
7 |
var animG, offsetW, offsetH = null;
|
|
|
8 |
var lieferbox = null;
|
|
|
9 |
var _loaded = false;
|
|
|
10 |
|
|
|
11 |
var boxMixin = {
|
|
|
12 |
startWidth: 0,
|
|
|
13 |
startHeight: 0,
|
|
|
14 |
endWidth: 518,
|
|
|
15 |
endHeight: 299,
|
|
|
16 |
duration: 650
|
|
|
17 |
};
|
|
|
18 |
|
|
|
19 |
/* DoJoX part */
|
|
|
20 |
dojo.addOnLoad(function() {
|
|
|
21 |
lieferbox = dojo.byId('lieferbox');
|
|
|
22 |
centerNode(lieferbox);
|
|
|
23 |
dojo.connect(lieferbox,"onmouseover",null,"show");
|
|
|
24 |
dojo.connect(lieferbox,"onmouseout",null,"hideCheck");
|
|
|
25 |
//dojo.connect(lieferbox,"onmouseout",null,"hideCheck");
|
|
|
26 |
//dojo.connect(but1,"onclick",null,"show");
|
|
|
27 |
_loaded = true;
|
|
|
28 |
});
|
|
|
29 |
|
|
|
30 |
function hideCheck(node) {
|
|
|
31 |
if (_showing) {
|
|
|
32 |
setTimeout("hide('lieferbox')",250);
|
|
|
33 |
}
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
function centerNode(node) {
|
|
|
37 |
var viewport = dijit.getViewport();
|
|
|
38 |
var mb = dojo.marginBox(node);
|
|
|
39 |
var style = node.style;
|
|
|
40 |
offsetW = mb.w - style.width;
|
|
|
41 |
offsetH = mb.h - style.height;
|
|
|
42 |
style.left = (viewport.l + (viewport.w - mb.w)/2) + "px";
|
|
|
43 |
style.top = (viewport.t + (viewport.h - mb.h)/2) + "px";
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
function doUnderlay() {
|
|
|
47 |
console.debug('make underlay');
|
|
|
48 |
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
function show(node) {
|
|
|
52 |
if(!_loaded) { return ; }
|
|
|
53 |
if (_showing) { return; }
|
|
|
54 |
lieferbox = dojo.byId('lieferbox');
|
|
|
55 |
if (animG && animG.status == "playing") { animG.stop(); }
|
|
|
56 |
_showing = true;
|
|
|
57 |
var viewport = dijit.getViewport();
|
|
|
58 |
|
|
|
59 |
var newLeft = (viewport.l + (viewport.w - boxMixin.endWidth)/2);
|
|
|
60 |
var newTop = (viewport.t + (viewport.h - boxMixin.endHeight)/2);
|
|
|
61 |
|
|
|
62 |
var style = lieferbox.style;
|
|
|
63 |
var anim1 = dojo.animateProperty({
|
|
|
64 |
node: lieferbox,
|
|
|
65 |
duration: boxMixin.duration/2,
|
|
|
66 |
properties: {
|
|
|
67 |
width: { /* start: boxMixin.startWidth, */ end: boxMixin.endWidth, unit:"px" },
|
|
|
68 |
left: { end: newLeft, unit:"px" }
|
|
|
69 |
},
|
|
|
70 |
beforeBegin: doUnderlay()
|
|
|
71 |
});
|
|
|
72 |
var anim2 = dojo.animateProperty({
|
|
|
73 |
node: lieferbox,
|
|
|
74 |
duration: boxMixin.duration/2,
|
|
|
75 |
properties: {
|
|
|
76 |
height: { /*start: boxMixin.startHeight, */ end: boxMixin.endHeight, unit:"px" },
|
|
|
77 |
top: { end: newTop, unit: "px" }
|
|
|
78 |
},
|
|
|
79 |
onEnd: function() {
|
|
|
80 |
_showing = true;
|
|
|
81 |
dojo.byId('lieferbox').style.overflow = 'visible';
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
});
|
|
|
85 |
|
|
|
86 |
animG = dojo.fx[animationMethod]([anim1,anim2]).play();
|
|
|
87 |
|
|
|
88 |
// chain:
|
|
|
89 |
|
|
|
90 |
// animate width / left position
|
|
|
91 |
// animate height / top position
|
|
|
92 |
// onend: fadeIn content?
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
function hide(node) {
|
|
|
96 |
if (!_showing) return;
|
|
|
97 |
if (animG && animG.status() == "playing") { animG.stop(); }
|
|
|
98 |
|
|
|
99 |
var viewport = dijit.getViewport();
|
|
|
100 |
var newLeft = (viewport.l + (viewport.w - boxMixin.startWidth)/2);
|
|
|
101 |
var newTop = (viewport.t + (viewport.h - boxMixin.startHeight)/2);
|
|
|
102 |
|
|
|
103 |
var style = node.style;
|
|
|
104 |
var anim1 = dojo.animateProperty({
|
|
|
105 |
node: lieferbox,
|
|
|
106 |
duration: boxMixin.duration/2,
|
|
|
107 |
properties: {
|
|
|
108 |
width: { end: boxMixin.startWidth, unit:"px" },
|
|
|
109 |
left: { end: newLeft, unit:"px" }
|
|
|
110 |
}
|
|
|
111 |
});
|
|
|
112 |
var anim2 = dojo.animateProperty({
|
|
|
113 |
node: lieferbox,
|
|
|
114 |
duration: boxMixin.duration/2,
|
|
|
115 |
properties: {
|
|
|
116 |
height: { end: boxMixin.startHeight, unit:"px" },
|
|
|
117 |
top: { end: newTop, unit: "px" }
|
|
|
118 |
},
|
|
|
119 |
onBegin: function() {
|
|
|
120 |
_showing = true;
|
|
|
121 |
dojo.byId('lieferbox').style.overflow = 'hidden';
|
|
|
122 |
},
|
|
|
123 |
onEnd: function() {
|
|
|
124 |
_showing = false;
|
|
|
125 |
//dojo.byId('lieferbox').style.overflow = 'hidden';
|
|
|
126 |
}
|
|
|
127 |
});
|
|
|
128 |
// if we chain, do anim2 first [because height/top is how anim2 in show() ends]
|
|
|
129 |
animG = dojo.fx[animationMethod]([anim2,anim1]).play();
|
|
|
130 |
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
/* end dojox */
|