diff --git a/datacenterlight/static/datacenterlight/js/main.js b/datacenterlight/static/datacenterlight/js/main.js index 79422844..c508d76d 100644 --- a/datacenterlight/static/datacenterlight/js/main.js +++ b/datacenterlight/static/datacenterlight/js/main.js @@ -86,6 +86,20 @@ } function _initNavUrl() { + $('.url-init').each(function(idx, el) { + var $this = $(el); + var currentPath = window.location.pathname; + var thisPaths = $this.attr('href').split('#') + if ($this.hasClass('dropdown-toggle') && window.matchMedia("(max-width: 767px)").matches) { + $this.removeClass('url-init'); + $this.attr('href', ''); + } else if ($('#'+thisPaths[1]).length) { + $this.removeClass('url-init').addClass('url'); + $this.attr('href', '#' + thisPaths[1]); + } else { + $this.removeClass('url-init'); + } + }); $('.url').click(function(event) { event.preventDefault(); var href = $(this).attr('href'); @@ -95,8 +109,6 @@ $('html, body').animate({ scrollTop: $(href).offset().top }, 1000); - } else { - window.location.href = '/datacenterlight' + href; } }); } diff --git a/datacenterlight/templates/datacenterlight/includes/_footer.html b/datacenterlight/templates/datacenterlight/includes/_footer.html index f77c3385..76c2c16e 100644 --- a/datacenterlight/templates/datacenterlight/includes/_footer.html +++ b/datacenterlight/templates/datacenterlight/includes/_footer.html @@ -2,52 +2,37 @@ {% get_current_language as LANGUAGE_CODE %} diff --git a/datacenterlight/templates/datacenterlight/includes/_navbar.html b/datacenterlight/templates/datacenterlight/includes/_navbar.html index 0cf4908e..3b8656ac 100644 --- a/datacenterlight/templates/datacenterlight/includes/_navbar.html +++ b/datacenterlight/templates/datacenterlight/includes/_navbar.html @@ -16,12 +16,11 @@