Если нажать на кнопку меню, то в строке адреса ссылки такого типа
http://mdstone.pro/#katalog, но на нужную страницу не переходит. Если нажать через правую кнопку мыши "открыть в новом вкладке", то все срабатывает. Если я правильно понимаю, работа меню задается тут
//////////////////////////////////////////////////////////////////////
// AJAX SCRIPTS & HASH //
//////////////////////////////////////////////////////////////////////
hash = window.location.hash.substr(1);
title = document.title;
if (hash == '') sections(); // if nothing is there, launch the sections!
var href = $('.nav-bar li a').each(function(index){
var href = $(this).attr('href');
var page = location.pathname.substr(location.pathname.lastIndexOf("/")+1,location.pathname.length);
var p = page.substr(0, page.length-(extension.length+1));
var toLoad = hash+'.'+extension+' #content .target';
if(hash==href.substr(0,href.length-(extension.length+1)) ){
// hash in menu
hideContent();
if (hash != '' && hash != p) $('#content .new').load(toLoad, '', showContent); // called when hash is detected
} else {
if (index == $('.nav-bar li').length-1 ) processHash(); // if there is no link in registered in the menu, try to process it anyway
}
});
function processHash() {
//console.log('processing hash');
var page = location.pathname.substr(location.pathname.lastIndexOf("/")+1,location.pathname.length);
var p = page.substr(0, page.length-(extension.length+1));
var toLoad = hash+'.'+extension+' #content .target';
hideContent();
if (hash != '' && hash != "#" && hash != p) $('#content .new').load(toLoad, '', showContent); // called when hash is detected
}
$(window).bind( "hashchange", function(e) {
//console.log('hash changed!')
hash = window.location.hash;
var l = hash+'.'+extension+' #content .target';
hideContent();
if (hash != '' && hash != "#") { $('#content .new').load(l.substr(1), '', showContent); } else { window.location.hash = '#index'; }
//refreshTitle();
//console.log('loading: '+l + 'hash: '+hash);
});
// this snippet hides the background on mobile devices and shows up again when the viewport focuses it.
if ($(window).width() < 767){
$(window).scroll( function(e) {
//console.log('scroll');
var wH = $(window).height();
var sH = $(window).scrollTop();
//console.log(wH+'+'+sH);
if (sH > wH) {
$('#bg').css({'display':'none', 'opacity':0});
} else {
if ($('#bg').css('opacity') == 0 ) $('#bg').css({'display':'block', 'opacity':0}).transition({'opacity':1});
}
});
}
function refreshTitle() {
// takes out the title from hash
var s;
hash.indexOf('#') ? s = 0 : s = 1;
var str = hash.substr(s);
// converts first letter to uppercase
str = str.toLowerCase().replace(/\b[a-z]/g, function(letter) {
return letter.toUpperCase();
});
var subtitle = $('h1.headline span').text();
//console.log('subtitle is: '+subtitle);
if (subtitle=="") subtitle = str;
if (hash != 'index' && hash != '' && hash !='#index') {
document.title = title + ' | '+ subtitle;
} else {
document.title = title;
}
}
// click function for whole menu and logo in the header
$('.nav-bar li a:not([target]):not([href^="#"]):not(.selected), .logo a').click(function(e){
var active = false;
if (Modernizr.touch && $(this).hasClass('selected') ) {
active = true;
e.preventDefault();
$(this).trigger('mouseenter');
if ($(this).hasClass('touched')) {
$(this).removeClass('touched');
active = false;
} else {
$(this).addClass('touched');
}
}
if (active == false) {
clicked = true;
initiated = false;
//adds a 'selected' class to the main menu and removes from the others
$('.nav-bar li a, .logo a').each(function(){ if ($(this).hasClass('selected')) { $(this).removeClass('selected'); }; if ($(this).hasClass('touched')) { $(this).removeClass('touched'); }})
if ($(this).hasClass('main')) { $(this).addClass('selected'); } else { $(this).parent().parent().parent().parent().children('.main').addClass('selected'); }
var toLoad = $(this).attr('href')+' #content .target ';
var selected = $(this).attr('href');
var current = window.location.hash.substr(1);
var page = location.pathname.substr(location.pathname.lastIndexOf("/")+1,location.pathname.length);
//console.log('LOADING: '+ selected.substr(0,selected.length-(extension.length+1)) +', current location is: '+current );
if ( $('.nav-bar li a'))
if (selected.substr(0,selected.length-(extension.length+1)) != current) { // check if it's already selected first
if (current == '' && page == selected) { } else { hideContent(); loadContent(); }
}
if ($.browser.msie && parseInt($.browser.version, 10) < 8) {
window.location = '#'+($(this).attr('href').substr(0,$(this).attr('href').length-(extension.length+1))).replace(/^.*[\\\/]/, '');
} else {
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-(extension.length+1));
}
}
function loadContent() {
if (!"onhashchange" in window || $.browser.msie ) {
if ($.browser.msie ){
if (parseInt($.browser.version, 10) < 8 && selected !='#') $('#content .new ').load(toLoad,'',showContent);
} else{
$('#content .new ').load(toLoad,'',showContent);
}
}
// show fake load bar
var barW = $('#header .bar').parent().width()+'px';
$('#header .bar').css({'opacity':.5,'width':0}).stop().animate({'width':barW},'500');;
}
return false;
});
function hideContent() {
//console.log('hiding content');
$('#content .old').empty(); // purge old container
var h = $(window).height() - $('#header').height();
$('#content .wrapper').children('.old').css({height:h});
if (window.location.hash.substr(1) != '') {
$('#content .new').contents().clone().appendTo('#content .old'); // move actual content in old container
if (mobile && !ipad) $('#content .new').empty();
} else {
$('#content .new').contents().clone().appendTo('#content .old');
}
}
function showContent() {
//console.log('showing content');
clearContent();
//if (!mobile && Modernizr.touch) hideNav();
arrange();
$('#content').delay(1000, slidePages() );
// slide old and new wrappers
function slidePages() {
//console.log('sliding pages... new margin is: ' +$('#content').children('.new').css('height') + ' old margin is: '+ $('#content').children('.old').css('height') );
hideNav();
$('#header .bar').transition({'opacity':'0'}, 'slow'); // fade out fake loadbar, as it's already loaded
function showBg() {
$.browser.msie ? $('.bg-gallery').stop().animate({'opacity':1}, 'slow') : $('#bg').css({'opacity':1}); // show background if hidden
}
$('#content .wrapper').children('.old').transition({ height: 0},'1000',function() {
$('#content .wrapper').children('.old').empty().css({height:0}); // get rid of old container
if (!$('.new .target .portfolio').length && !$('.new .contact').length) showBg();
sections();
if ( $(window).width() < 767 && $('#main').attr('data-mobileautofocus') != "false") { $('html,body').animate({scrollTop: $('#content .new').offset().top}, 'slow'); }
});
}
}
function clearContent() {
if (scroller != null) { scroller.destroy(); scroller = null; };
if ($('#content .map').length) $('#content .map').remove(); // get rid of the heavy map at once!
//if (isotopeEnabled) { $('#content .works').isotope('destroy');}// destroy any pending works holder
if ($('.old .target .project').length) $('.old .target .project').css({'height':0});
}