navigation fixes

This commit is contained in:
2018-03-19 14:20:01 +01:00
parent ff0fff0c5e
commit 340767ddab
9 changed files with 154 additions and 47 deletions

View File

@@ -37,6 +37,30 @@ $(function() {
}
});
$body.on('mouseenter', '.navigation__item', function(event) {
var $this = $(this);
var $navigation_main = $this.parents('.navigation__main');
$navigation_main.attr('data-focus', $this.attr('data-id'));
});
$body.on('mouseleave', '.navigation__item', function(event) {
var $this = $(this);
var $navigation_main = $this.parents('.navigation__main');
$navigation_main.removeAttr('data-focus');
});
$body.on('mouseenter', '.navigation__item__list a', function(event) {
var $this = $(this);
var $navigation_main = $this.parents('.navigation__main');
$navigation_main.attr('data-hover', $this.parents('.navigation__item').attr('data-id'));
});
$body.on('mouseleave', '.navigation__item__list a', function(event) {
var $this = $(this);
var $navigation_main = $this.parents('.navigation__main');
$navigation_main.removeAttr('data-hover');
});
$body.on('click', '.header__button--navigation', function(event) {
if ($body.hasClass('search_open')) {
if (!$body.hasClass('_search') && !$body.hasClass('search_results')) {
@@ -82,8 +106,12 @@ $(function() {
function close_navigation() {
$navigation.removeAttr('style');
var $navigation_main = $navigation.find('.navigation__main');
$body.removeClass('navigation_open');
window.requestAnimationFrame(function() {
$navigation_main.removeAttr('data-focus');
$navigation_main.removeAttr('data-hover');
$navigation_main.removeAttr('data-active');
$canvas.removeAttr('style');
$(window).scrollTop(scroll_top);
window.navigation_is_open = false;