Skip to content

Commit

Permalink
added resize calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
FinalAngel committed Jun 24, 2014
1 parent 05142d4 commit 01a416c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cl.mobilemenu/CHANGELOG.rst
Expand Up @@ -2,6 +2,10 @@
Cl.MobileMenu
=============

1.1.4
-----
- added resize calculations

1.1.3
-----
- rename ``MobileMenu`` to ``Mobilemenu``
Expand Down
13 changes: 13 additions & 0 deletions src/cl.mobilemenu/cl.mobilemenu.js
Expand Up @@ -71,6 +71,7 @@ var Cl = window.Cl || {};
// attach resize event for hiding mobile menu
$(window).on('resize.menu', function () {
if(that.visible && $(window).width() >= that.options.bound) that.hide(0);
if (that.visible) that.resize();
that.menu.height('min-height', that._setHeight());
});
},
Expand Down Expand Up @@ -142,6 +143,18 @@ var Cl = window.Cl || {};
this._fire('hide');
},

resize: function() {
// depending on current window width
this.width = ($(window).width() * this.options.ratio);
this.html.css({
'margin-left': this.width
});
this.menu.css({
'width': this.width,
'left': -this.width + this.options.offset.left
});
},

_validate: function () {
return ($(window).width() < this.options.bound) ? true : false;
},
Expand Down

0 comments on commit 01a416c

Please sign in to comment.