Merge pull request #415 from tiwariav/bugfix/3553/navbar

Task #3553 fix page "blinks" on click on navbar link
This commit is contained in:
Pcoder 2017-07-27 21:55:27 +02:00 committed by GitHub
commit 8dd1cbda19
3 changed files with 538 additions and 373 deletions

File diff suppressed because it is too large Load diff

View file

@ -69,7 +69,6 @@
$(window).scroll(function() { $(window).scroll(function() {
_navScroll(); _navScroll();
}); });
} }
function _navScroll() { function _navScroll() {
@ -85,20 +84,30 @@
$(".dropdown-menu > li > a").css("color", "#fff"); $(".dropdown-menu > li > a").css("color", "#fff");
} }
} }
function _initNavUrl() { function _initNavUrl() {
$('.url').click(function(){ $('.url').click(function(event) {
event.preventDefault();
var href = $(this).attr('data-url'); var href = $(this).attr('data-url');
$('.navbar-collapse').removeClass('in'); $('.navbar-collapse').removeClass('in');
$('.navbar-collapse').addClass('collapsing'); $('.navbar-collapse').addClass('collapsing');
var url = window.location.pathname;
var urlSplit = url.split('/');
if (urlSplit.length === 3 && urlSplit[2] === 'datacenterlight') {
$('html, body').animate({ $('html, body').animate({
scrollTop: $(href).offset().top scrollTop: $(href).offset().top
}, 1000); }, 1000);
} else {
var allUrl = window.location.href;
var redirect = allUrl.split('whydatacenterlight')
window.location.href = '/en-us/datacenterlight' + href;
}
}); });
} }
function verifiedUrl() { function verifiedUrl() {
if (window.location.href.indexOf('#success') > -1) { if (window.location.href.indexOf('#success') > -1) {
form_success(); form_success();
console.log('epa');
} }
} }
@ -127,6 +136,7 @@
_fetchPricing(); _fetchPricing();
}); });
} }
function _fetchPricing() { function _fetchPricing() {
Object.keys(cardPricing).map(function(element) { Object.keys(cardPricing).map(function(element) {
//$('#'+cardPricing[element].id).val(cardPricing[element].value); //$('#'+cardPricing[element].id).val(cardPricing[element].value);
@ -142,13 +152,13 @@
$("#total").text(total); $("#total").text(total);
$('input[name=total]').val(total); $('input[name=total]').val(total);
} }
function form_success() { function form_success() {
$('#sucessModal').modal('show'); $('#sucessModal').modal('show');
} }
function _calculate(numbers, price) { function _calculate(numbers, price) {
$('#valueTotal').text(numbers * price * 31); $('#valueTotal').text(numbers * price * 31);
} }
})(jQuery); })(jQuery);

View file

@ -12,11 +12,11 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
{% if request.resolver_match.url_name == "index" or request.resolver_match.url_name == "whydatacenterlight" %} {% if request.resolver_match.url_name == "index" or request.resolver_match.url_name == "whydatacenterlight" %}
<a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav url" data-url="#home"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a> <a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav" data-url="#home"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a>
<a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav url" data-url="#home"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a> <a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav" data-url="#home"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a>
{% else %} {% else %}
<a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav url"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a> <a href="{% url 'datacenterlight:index' %}" id="logoBlack" class="navbar-brand topnav"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a>
<a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav url"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a> <a href="{% url 'datacenterlight:index' %}" id="logoWhite" class="navbar-brand topnav"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a>
{% endif %} {% endif %}
</div> </div>
@ -25,15 +25,15 @@
{% if request.resolver_match.url_name == "index" or request.resolver_match.url_name == "whydatacenterlight" %} {% if request.resolver_match.url_name == "index" or request.resolver_match.url_name == "whydatacenterlight" %}
<li class="dropdown"> <li class="dropdown">
<a class="dropdown-toggle visible-mobile" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a> <a class="dropdown-toggle visible-mobile" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a>
<a class="dropdown-toggle url disabled visible-desktop" href="{% url 'datacenterlight:index' %}#how" data-url="#how" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a> <a class="dropdown-toggle url disabled visible-desktop menu-url" data-url="#how" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}<span class="caret"></span></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a class="url" href="{% url 'datacenterlight:index' %}#your" data-url="#your" >{% trans "Scale out" %}</a></li> <li><a class="url menu-url" data-url="#your" href="#your">{% trans "Scale out" %}</a></li>
<li><a class="url" href="{% url 'datacenterlight:index' %}#our" data-url="#our">{% trans "Reliable and light" %}</a></li> <li><a class="url menu-url" data-url="#our" href="#our">{% trans "Reliable and light" %}</a></li>
<li> <a class="url" href="{% url 'datacenterlight:index' %}#price" data-url="#price" >{% trans "Order VM" %}</a></li> <li> <a class="url menu-url" data-url="#price" href="#price">{% trans "Order VM" %}</a></li>
</ul> </ul>
</li> </li>
<li> <li>
<a class="url" href="{% url 'datacenterlight:index' %}/whydatacenterlight" >{% trans "Why Data Center Light?" %}</a> <a href="{% url 'datacenterlight:index' %}/whydatacenterlight" >{% trans "Why Data Center Light?" %}</a>
</li> </li>
<li> <li>
<a class="url" href="{% url 'datacenterlight:index' %}#contact" data-url="#contact" >{% trans "Contact" %}</a> <a class="url" href="{% url 'datacenterlight:index' %}#contact" data-url="#contact" >{% trans "Contact" %}</a>
@ -48,11 +48,12 @@
{% endif %} {% endif %}
<i class="fa fa-globe" aria-hidden="true"></i> <i class="fa fa-globe" aria-hidden="true"></i>
</div> </div>
<div onclick="return true" class="drop-language">
<div class="drop-language">
{% if LANGUAGE_CODE == 'en-us'%} {% if LANGUAGE_CODE == 'en-us'%}
<a class="url" href="{% change_lang 'de' %}">Deutsch</a> <a href="{% change_lang 'de' %}">Deutsch</a>
{% else %} {% else %}
<a class="url" href="{% change_lang 'en-us' %}" >English</a> <a href="{% change_lang 'en-us' %}" >English</a>
{% endif %} {% endif %}
</div> </div>