Показать сообщение отдельно
  #2 (permalink)  
Старый 21.09.2015, 11:00
Новичок на форуме
Отправить личное сообщение для grach28rus Посмотреть профиль Найти все сообщения от grach28rus
 
Регистрация: 21.09.2015
Сообщений: 6

Добавляю подробный код
$(document).on("click","table.tabinstructions a.news", getnews);
    $(document).on("click","table.tabinstructions a.contact", getcontact);
function getnews(e){
    e.preventDefault();
    var href = $(this).attr('href');
    getcontent(href, true);
    moveL=0;
    moveR=0;
}
function getcontact(e){
    e.preventDefault();
    var href = $(this).attr('href');
    getcontent(href, true);
    moveL=0;
    moveR=0;
}
function getcontent(url, addhistory){
    switch (url) {

        case "HowToMakeAnOrder/":
            url1 = "menucontent/helpcheckout.php";
            break;
        case "news/":
            url1 = "menucontent/news.php";
            break;
        case "contact/":
            url1 = "menucontent/contactcontent.php";
            break;
        default: url = "";

    }
    alert(window.history.length);
    alert(window.history.state);
    $.post(url1).done(function(data){

        $("#mid").html(data);
        if(addhistory==true)  history.pushState(null, null, url);
    });
}
Ответить с цитированием