Answer the question
In order to leave comments, you need to log in
How can I fix the code so that it works properly?
Good afternoon everyone, I encountered a bug after loading a page in a block without reloading the entire page (as in VK).
Everything works except url
and title
it looks like this if you use the code
http://сайт/услуги/тип-услуги/услуга#услуги/тип-услуги/услуга
title
remains the same as it was http://сайт/услуги/тип-услуги/услуга
title
$(document).ready(function() {
// Check for hash value in URL
var hash = window.location.hash.substr(1);
var href = $('#nav-page li a').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+'.html #content-page';
$('#content-page').load(toLoad)
}
});
$('#nav-page li a').click(function(){
var toLoad = $(this).attr('href')+' #content-page';
$('#content-page').hide('fast',loadContent);
$('#load-page').remove();
$('#content-page').append('LOADING...');
$('#load-page').fadeIn('normal');
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
function loadContent() {
$('#content-page').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content-page').slideDown('normal',hideLoader());
}
function hideLoader() {
$('#load').fadeOut('normal');
}
var title = $('.title-page').text();
var bread = $('.breadcrumb-item-page').text();
$('.breadcrumb-item-page').text(title);
return false;
});
});
Answer the question
In order to leave comments, you need to log in
change the title (but why?):
about the url: - does not change the entire url, but adds a hash to it (the one after the symbol ).
this may be useful and necessary in a number of cases, but here it is clearly the wrong approach.
A computer with 3-4 modems is the easiest to get. And probably the cheapest.
Or a raspberry-type microcomputer.
In general, there are such solutions, just for data centers
https://habrahabr.ru/post/240943/
Or here on the Toaster
Device for working with a large number of SIM cards at the same time?
What is the device for receiving SMS from many SIM cards at the same time?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question