From 5550867870875ede08b45548099b2c13554e0826 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 1 Sep 2017 01:27:44 +0530 Subject: [PATCH] navbar link hash fixed, footer links fixed --- .../static/datacenterlight/js/main.js | 16 +++- .../datacenterlight/includes/_footer.html | 77 ++++++++----------- .../datacenterlight/includes/_navbar.html | 9 +-- datacenterlight/views.py | 6 +- hosting/static/hosting/css/landing-page.css | 2 +- hosting/static/hosting/js/initial.js | 29 ++++++- 6 files changed, 80 insertions(+), 59 deletions(-) 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 @@