-
Notifications
You must be signed in to change notification settings - Fork 1
Add menu positioning settings #304
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
base: master
Are you sure you want to change the base?
Changes from 8 commits
765526f
d46bc68
3cf87b3
17ac964
521349f
c58c179
5a31cb2
dc8812e
404f08e
44e9f19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| {% if editmode %} | ||
| <button class="mobile-menu-button-settings"></button> | ||
| {% endif %} | ||
|
|
||
| {% editorjsblock %} | ||
| <!-- Settings popover javascript. --> | ||
| <script | ||
| src="{{ site.static_asset_host }}/libs/edicy-tools/latest/edicy-tools.js" | ||
| ></script> | ||
|
|
||
| <!-- Setings popover initiation. --> | ||
| <script> | ||
| var siteData = new Edicy.CustomData({ | ||
| type: 'site', | ||
| id: {{ site.id }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lehe datal pole id-d |
||
| }); | ||
|
|
||
| {% if site.data.mobile_menu_button_settings %} | ||
| var valuesObj = {{ site.data.mobile_menu_button_settings | json }}; | ||
| {% else %} | ||
| var valuesObj = {}; | ||
| {% endif %}; | ||
|
|
||
| var mobileMenuSettingsButton = document.querySelector('.mobile-menu-button-settings'); | ||
|
|
||
| var SettingsEditor = new Edicy.SettingsEditor(mobileMenuSettingsButton, { | ||
| menuItems: [ | ||
| { | ||
| "titleI18n": "menu_positioning", | ||
| "type": "radio", | ||
| "key": "menu_positioning", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lisada ka tooltip nagu antud PRis. |
||
| "list": [ | ||
| { | ||
| "titleI18n": "fixed_in_header", | ||
| "value": "" | ||
| }, | ||
| { | ||
| "titleI18n": "always_visible", | ||
| "value": "visible-when" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need väärtused on vahetusse läinud: |
||
| }, | ||
| { | ||
| "titleI18n": "visible_when_scrolling_up", | ||
| "value": "always-visible" | ||
| }, | ||
| ], | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Komad üleliigsed objektil ja arrayl. Liigne tühi rida. |
||
| }, | ||
| ], | ||
|
|
||
| // Binded data object which should contain custom data object. | ||
| values: valuesObj, | ||
|
|
||
| // Style type the button. | ||
| buttonStyle: 'default', | ||
| // Title for the button. | ||
| buttonTitleI18n: 'mobile_view_settings', | ||
|
|
||
| commit: function(data) { | ||
| siteData.set('mobile_menu_button_settings', data, { | ||
| success: function() { | ||
| window.location.reload(); | ||
| } | ||
| }); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Joondus paigast. |
||
| } | ||
| }); | ||
| </script> | ||
| {% endeditorjsblock %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |
| <div class="header-title content-area">{% unless editmode %}<a href="{{ site.root_item.url }}">{% endunless %}{% editable site.header %}{% unless editmode %}</a>{% endunless %}</div> | ||
| </div> | ||
|
|
||
| <div class="header-right js-header-right"> | ||
| <div class="header-right {{ site.data.menu_position_settings.menu_positioning }} js-header-right"> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. data nimetus peaks olema |
||
| {% include "menu-main" %} | ||
|
|
||
| <div class="site-options"> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,21 @@ | |
| return $('html').hasClass('editmode'); | ||
| }; | ||
|
|
||
| // show mobile menu on scrolling up | ||
| var lastScrollTop = 0; | ||
| $(window).scroll(function() { | ||
| var st = $(this).scrollTop(); | ||
| if (st > lastScrollTop) { | ||
| setTimeout(function(){ | ||
| $('.visible-when').removeClass('scrolling'); | ||
| }, 400); | ||
| } else { | ||
| $('.visible-when').addClass('scrolling'); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Üleliigne tühi rida |
||
| } | ||
| lastScrollTop = st; | ||
| }); | ||
|
|
||
| // Function to limit the rate at which a function can fire. | ||
| var debounce = function(func, wait, immediate) { | ||
| var timeout; | ||
|
|
@@ -249,6 +264,15 @@ | |
| } | ||
| }; | ||
|
|
||
| var toggleMobileMenuButtonPosition = function() { | ||
| var $mobileMenuButtonElement = $('.js-mobile-menu-button-wrapper'); | ||
| if ($(window).width() <= 1024) { | ||
| $mobileMenuButtonElement.appendTo('.js-menu-main-mobile'); | ||
| } else if ($(window).width() > 1024) { | ||
| $mobileMenuButtonElement.appendTo('.js-menu-language-popover-setting-parent'); | ||
| } | ||
| }; | ||
|
|
||
| var bindFallbackHeaderLeftWidthCalculation = function() { | ||
| var headerWidth = $('.js-header-top-wrap').width(), | ||
| headerRight = $('.js-header-right'), | ||
|
|
@@ -813,6 +837,7 @@ | |
| commentsHeight(); | ||
| handleMobileSearchHeight(); | ||
| toggleLanguageSettingsLocation(); | ||
| toggleMobileMenuButtonPosition(); | ||
|
|
||
| $('.js-menu-language-settings-popover').hide(); | ||
| }, 100)); | ||
|
|
@@ -1040,7 +1065,7 @@ | |
| focusFormWithErrors(); | ||
| //autoSizeFormCommentArea(); | ||
| detectDesignEditorChanges(); | ||
|
|
||
| toggleMobileMenuButtonPosition(); | ||
| if (!Modernizr.flexbox && editmode()) { | ||
| bindFallbackHeaderLeftWidthCalculation(); | ||
| } | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,6 +105,32 @@ | |
|
|
||
| @media screen and (max-width: $tablet-1) { | ||
| margin-top: 1px; | ||
|
|
||
| &.always-visible { | ||
| position: fixed; | ||
| top: 40px; | ||
| right: 40px; | ||
| z-index: 1001; | ||
| height: 100vh; | ||
|
|
||
| .mobilemenu-open & { | ||
| right: 270px; | ||
| } | ||
| } | ||
|
|
||
| &.visible-when, { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Koma on üleliigne |
||
| &.scrolling { | ||
| position: fixed; | ||
| top: 40px; | ||
| right: 40px; | ||
| z-index: 1001; | ||
| height: 100vh; | ||
|
|
||
| .mobilemenu-open & { | ||
| right: 270px; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @media screen and (max-width: $tablet-3) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Üleliigsed tühikud