Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#4684 Add mobile nav menu to default theme #2442

Merged
merged 22 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b04f340
pkp/pkp-lib#4684 Added mobile nav menu for smaller screens
thinkbulecount2 Jul 11, 2019
0b5a27f
Replaced pkp_site_name in body.less to remove default 100% width
thinkbulecount2 Jul 11, 2019
6450612
pkp/pkp-lib#4684 HTML adjustments for default theme mobile nav menu
NateWr Jul 16, 2019
66af1c7
pkp/pkp-lib#4684 Added close symbol to open mobile nav menu
thinkbulecount2 Jul 22, 2019
54cc173
pkp/pkp-lib#4684 Renamed classes
thinkbulecount2 Jul 22, 2019
13beda5
pkp/pkp-lib#4684 Toggle nav menu dropdowns on small/large screens
NateWr Jul 22, 2019
5eb74c6
pkp/pkp-lib#4684 Moved .pkp_nav_list class to a media query
thinkbulecount2 Jul 24, 2019
552e337
Moved .pkp_nav_list out of helpers, so deleting it
thinkbulecount2 Jul 24, 2019
14a2976
pkp/pkp-lib#4684 Fixed mobile nav styles, added two search bars
thinkbulecount2 Jul 26, 2019
6468949
pkp/pkp-lib#4684 CSS for two menu bars WIP
thinkbulecount2 Aug 6, 2019
d6e6126
pkp/pkp-lib#4684 Fixed what is showing and what is not in search bars
thinkbulecount2 Aug 12, 2019
0497cdc
pkp/pkp-lib#4684 Styling mobile search bar
thinkbulecount2 Aug 12, 2019
18b7037
pkp/pkp-lib#4684 Added separate search form for mobile
thinkbulecount2 Aug 12, 2019
7548010
pkp/pkp-lib#4684 Work out layout/design issues with mobile nav in def…
NateWr Aug 12, 2019
fea442e
pkp/pkp-lib#4684 Remove unused search form template
NateWr Aug 13, 2019
29a13e0
pkp/pkp-lib#4684 Improve style of task count in nav menus
NateWr Aug 13, 2019
b9c8fa6
pkp/pkp-lib#4684 Fix inaccessible user nav item due to lost hover
NateWr Aug 13, 2019
9b9e423
pkp/pkp-lib#4684 Fix mobile nav menu widths from phone to tablet size
NateWr Aug 19, 2019
d0f7ef6
pkp/pkp-lib#4684 Remove mobile user nav styles on large screens
NateWr Aug 19, 2019
53a198d
pkp/pkp-lib#4684 Restore animated search styles in default theme header
NateWr Aug 19, 2019
36766ac
pkp/pkp-lib#4684 Fix search form class and mobile nav padding
NateWr Oct 25, 2019
fc5f6be
Submodule update ##NateWr/i4684_nav_menu##
NateWr Oct 28, 2019
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
55 changes: 41 additions & 14 deletions plugins/themes/default/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,55 @@
*/
(function($) {

// Initialize dropdown navigation menus
// Initialize dropdown navigation menus on large screens
// See bootstrap dropdowns: https://getbootstrap.com/docs/4.0/components/dropdowns/
if (typeof $.fn.dropdown !== 'undefined') {
var $nav = $('#navigationPrimary, #navigationUser'),
$submenus = $('ul', $nav);
function toggleDropdowns() {
if (window.innerWidth > 992) {
$submenus.each(function(i) {
var id = 'pkpDropdown' + i;
$(this)
.addClass('dropdown-menu')
.attr('aria-labelledby', id);
$(this).siblings('a')
.attr('data-toggle', 'dropdown')
.attr('aria-haspopup', true)
.attr('aria-expanded', false)
.attr('id', id)
.attr('href', '#');
});
$('[data-toggle="dropdown"]').dropdown();

$submenus.each(function(i) {
var id = 'pkpDropdown' + i;
$(this)
.addClass('dropdown-menu')
.attr('aria-labelledby', id);
$(this).siblings('a')
.attr('data-toggle', 'dropdown')
.attr('aria-haspopup', true)
.attr('aria-expanded', false)
.attr('id', id)
.attr('href', '#');
} else {
$('[data-toggle="dropdown"]').dropdown('dispose');
$submenus.each(function(i) {
$(this)
.removeClass('dropdown-menu')
.removeAttr('aria-labelledby');
$(this).siblings('a')
.removeAttr('data-toggle')
.removeAttr('aria-haspopup')
.removeAttr('aria-expanded',)
.removeAttr('id')
.attr('href', '#');
});
}
}
window.onresize = toggleDropdowns;
$().ready(function() {
toggleDropdowns();
});

$('[data-toggle="dropdown"]').dropdown();
}

// Toggle nav menu on small screens
$('.pkp_site_nav_toggle').click(function(e) {
$('.pkp_site_nav_menu').toggleClass('pkp_site_nav_menu--isOpen');
$('.pkp_site_nav_toggle').toggleClass('pkp_site_nav_toggle--transform');
});


// Register click handlers for the search panel
var headerSearchPanelIsClosing = false,
headerSearchForm = $('#headerNavigationContainer .pkp_search'),
Expand Down
4 changes: 2 additions & 2 deletions plugins/themes/default/styles/body.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ a {


// Page container widths
.pkp_site_name,
.pkp_site_name_wrapper,
.pkp_navigation_primary_wrapper,
.pkp_navigation_user,
.pkp_search_mobile,
.pkp_structure_content,
.pkp_structure_footer {
.pkp_helpers_clear;
Expand Down Expand Up @@ -65,7 +66,6 @@ a {
position: relative;
width: 100%;
margin: 0 auto;
padding-left: @base;
padding-right: @base;

@media( min-width: @screen-tablet ) {
Expand Down
114 changes: 114 additions & 0 deletions plugins/themes/default/styles/components/nav-toggle.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Toggle button
.pkp_site_nav_toggle {
@thickness: 3px;

position: absolute;
top: 0;
left: 0;
width: @nav-menu-height;
height: @nav-menu-height;
border: 0;
background: none;
box-shadow: 1px 0 0 rgba(255,255,255,0.2), -1px 0 0 rgba(255,255,255,0.2);
z-index: 999;

&:focus {
outline: 1px dotted @text-bg-base;
box-shadow: none;
}

> span {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 24px;
height: 19px;
border-bottom: @thickness solid @text-bg-base;
text-indent: -9999px;
overflow: hidden;

&:before,
&:after {
content: "";
position: absolute;
left: 0;
width: 100%;
height: @thickness;
background: @text-bg-base;
}

&:before {
top: 0;
}

&:after {
top: 8px;
}
}
}

.pkp_site_nav_toggle--transform {
> span {

border-bottom: 0;
overflow: visible;

&:before {
top: 7px;
transform: rotate(-405deg) translateY(1px) translateX(-2px);
-webkit-transform: rotate(-405deg) translateY(1px) translateX(-2px);
}

&:after {
top: 14px;
transform: rotate(405deg) translateY(-3px) translateX(-4px);
-webkit-transform: rotate(405deg) translateY(-3px) translateX(-4px);
}
}
}

// Show/hide the nav menu
.pkp_site_nav_menu {
display: none;
}

.pkp_site_nav_menu--isOpen {
display: block;
}

body.navIsOpen {
.siteHeader__details {
right: 0;
}

.siteHeader__screen {
display: block;
opacity: 0.5;
}

.siteHeader__navToggleIcon {
> span {
&:first-child {
transform: rotate(45deg);
top: 18px;
}

&:nth-child(2) {
opacity: 0;
}

&:last-child {
transform: rotate(-45deg);
top: 18px;
}
}
}
}

@media (min-width: @screen-desktop) {

.pkp_site_nav_menu {
display: block;
}
}
Loading