up
This commit is contained in:
parent
f99574f53b
commit
b0976b5253
153 changed files with 590 additions and 533 deletions
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script src="menu.js"></script>
|
||||
<script>
|
||||
function AnimatingMenu() {
|
||||
Menu.apply(this, arguments);
|
||||
}
|
||||
|
||||
AnimatingMenu.prototype = Object.create(Menu.prototype);
|
||||
|
||||
AnimatingMenu.prototype.STATE_ANIMATING = 2;
|
||||
|
||||
AnimatingMenu.prototype.open = function() {
|
||||
var self = this;
|
||||
|
||||
this._state = this.STATE_ANIMATING;
|
||||
|
||||
this._timer = setTimeout(function() {
|
||||
Menu.prototype.open.call(self);
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
AnimatingMenu.prototype.close = function() {
|
||||
clearTimeout(this._timer);
|
||||
Menu.prototype.close.apply(this);
|
||||
};
|
||||
|
||||
AnimatingMenu.prototype._stateAsString = function() {
|
||||
|
||||
switch (this._state) {
|
||||
case this.STATE_ANIMATING:
|
||||
return 'анимация';
|
||||
|
||||
default:
|
||||
return Menu.prototype._stateAsString.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
// тест, использование..
|
||||
var menu = new AnimatingMenu();
|
||||
|
||||
menu.showState(); // закрыто
|
||||
|
||||
menu.open();
|
||||
menu.showState(); // анимация
|
||||
|
||||
setTimeout(function() { // через 1 секунду
|
||||
menu.showState(); // открыто
|
||||
|
||||
menu.close();
|
||||
menu.showState(); // закрыто
|
||||
}, 1000);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue