make the clock adjust its size on window resizing
This commit is contained in:
parent
633401862f
commit
c0742a6f11
2 changed files with 22 additions and 6 deletions
15
js/uhr.js
15
js/uhr.js
|
@ -108,6 +108,14 @@
|
|||
}
|
||||
update.bind(this)();
|
||||
};
|
||||
var setWidth = function setWidth(width) {
|
||||
var e = this.element;
|
||||
e.css('width', width);
|
||||
var realWidth = e.width();
|
||||
e.width(realWidth);
|
||||
e.height(realWidth);
|
||||
e.css('font-size', (realWidth / 40) + 'px');
|
||||
};
|
||||
|
||||
// private interface methods
|
||||
var create = function create() {
|
||||
|
@ -140,11 +148,7 @@
|
|||
e.append('<span class="item dot dot4"></span>');
|
||||
e.append('<div class="letterarea"></div>');
|
||||
e.append('<div class="reflection"></div>');
|
||||
e.css('width', this.options.width);
|
||||
var realWidth = e.width();
|
||||
e.width(realWidth);
|
||||
e.height(realWidth);
|
||||
e.css('font-size', (realWidth / 40) + 'px');
|
||||
setWidth.bind(this)(this.options.width);
|
||||
|
||||
if (this.options.controls) {
|
||||
var configlink = $('<a class="uhr-configlink" id="uhr-configlink' + this.id + '"></a>');
|
||||
|
@ -352,6 +356,7 @@
|
|||
"language": setLanguage,
|
||||
"theme": setTheme,
|
||||
"time": setTime,
|
||||
"width": setWidth,
|
||||
// constructor method
|
||||
"_create": create
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue