Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions css/jPushMenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
overflow-x: hidden;
position: relative;
left: 0;
top: 0;
}

.push-body-toright {
Expand Down
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ <h2>jPushMenu Demo</h2>
<button class="toggle-menu menu-right push-body">Toggle Right Menu Push</button>

<button class="toggle-menu menu-top">Toggle Top Menu</button>
<button class="toggle-menu menu-top push-body">Toggle Top Menu Push</button>

<button class="toggle-menu menu-bottom">Toggle Bottom Menu</button>

<h2>Changelog</h2>
Expand Down Expand Up @@ -133,6 +135,8 @@ <h3>Make button or link</h3>
<button class="toggle-menu menu-right push-body">Toggle Right Menu Push</button>

<button class="toggle-menu menu-top">Toggle Top Menu</button>
<button class="toggle-menu menu-top push-body">Toggle Top Menu Push</button>

<button class="toggle-menu menu-bottom">Toggle Bottom Menu</button>
</textarea>

Expand Down
22 changes: 19 additions & 3 deletions js/jPushMenu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* jPushMenu.js
* 1.1.1
* 1.2.1
* @author: takien
* http://takien.com
* Original version (pure JS) is created by Mary Lou http://tympanus.net/
Expand Down Expand Up @@ -32,6 +32,7 @@
}
else if ($(this).is('.' + o.showTopClass)) {
target = '.cbp-spmenu-top';
push_direction = 'tobottom';
}
else if ($(this).is('.' + o.showBottomClass)) {
target = '.cbp-spmenu-bottom';
Expand All @@ -44,6 +45,9 @@
$(this).toggleClass(o.activeClass);
$(target).toggleClass(o.menuOpenClass);

// Add the same height to the animation of push-menu to bottom
$(o.pushBodyClass + '-' + push_direction).css('top', $(target).height());

if ($(this).is('.' + o.pushBodyClass) && push_direction != '') {
$('body').toggleClass(o.pushBodyClass + '-' + push_direction);
}
Expand All @@ -57,10 +61,22 @@
var jPushMenu = {
close: function (o) {
$('.jPushMenuBtn,body,.cbp-spmenu')
.removeClass('disabled ' + o.activeClass + ' ' + o.menuOpenClass + ' ' + o.pushBodyClass + '-toleft ' + o.pushBodyClass + '-toright');
.removeClass('disabled ' + o.activeClass + ' ' + o.menuOpenClass + ' ' + o.pushBodyClass + '-toleft ' + o.pushBodyClass + '-toright ' + o.pushBodyClass + '-tobottom');
}
}

// Don't close menu on clicking inside it
$('.cbp-spmenu').click(function(e) {
e.stopImmediatePropagation();
});

// Closes when page scrolls
if (o.closeOnClickOutside) {
$(document).scroll(function() {
jPushMenu.close(o);
});
}

// Close menu on clicking outside menu
if (o.closeOnClickOutside) {
$(document).click(function() {
Expand All @@ -76,7 +92,7 @@
}
};

/*
/*
* In case you want to customize class name,
* do not directly edit here, use function parameter when call jPushMenu.
*/
Expand Down