Показать сообщение отдельно
  #6 (permalink)  
Старый 22.08.2014, 15:22
Интересующийся
Отправить личное сообщение для roma88 Посмотреть профиль Найти все сообщения от roma88
 
Регистрация: 20.05.2014
Сообщений: 19

может сдесь

function genCount() {
    var def = 460152;
    var ts = 1379591528;
    var ti = new Date().getTime();
    var tsi = parseInt(ti.toString().substring(0, 10));

    var rand = 5 + Math.floor(Math.random() * 10);

    var ta = def + parseInt((tsi - ts) / 5);
    jQuery('.counter').text(ta);
}

function step1Callback(){

    window.my = 0;

    jQuery(document).mousemove(function(e){
        window.my = e.pageY - window.scrollY;
    });

    window.onmouseout = function(evt){
        var cookie = jQuery.cookie('show_modal');
        if (evt.toElement == null && evt.relatedTarget == null && window.my<50 && typeof(cookie) == 'undefined' && cookie != 'false' && !window.lead) {
            jQuery('#dontLeaveMe').modal('show');

        }

        jQuery('#dontLeaveMe').on('hide.bs.modal', function (e) {
            jQuery.cookie('show_modal', 'false');
        })
    }
}

function modalCallback(){
    jQuery('#dontLeaveMe').modal('hide');
}

function leadCallback(){
    window.lead = true;
    form.goto('finish');
}

jQuery(document).ready(function () {

    $('#free_quest').focus();

    var form = new LeadiaForm({
        url: './lead.php',
        success: function (data) {
            form.goto('finish');
            jQuery('[data-toggle="tab"]').removeAttr('data-toggle');
        },
        callbacks: {
            'step1': step1Callback,
            'modal': modalCallback,
            'lead-sent': leadCallback
        }
    });

    genCount();
    setInterval(genCount, 6478);

    jQuery('.city-input').keyup(function () {
        if (jQuery(this).val().toLowerCase() == 'москва') {
            jQuery('[data-form-field="district"]').removeAttr('disabled');
        }
    });

    jQuery('.modal-about').click(function () {
        jQuery('#about').modal('show');
    });

    jQuery('.do-consult').click(function () {
        var text = jQuery(this).data('text');
        var textarea = jQuery('#consult .description');
        textarea.val(text);
        jQuery('#form-tabs a[href="#consult"]').tab('show');
        jQuery('html, body').animate({
            scrollTop: 0
        }, 200);
    });

    jQuery('.tab-control').click(function (e) {
        e.preventDefault();
        jQuery('.navbar-static-top li').removeClass('active');
        jQuery(this).parent().addClass('active');
        var tab = jQuery(this).attr('href');
        console.log(tab);
        jQuery('#form-tabs a[href="' + tab + '"]').tab('show');
        jQuery('html, body').animate({
            scrollTop: 0
        }, 200);
    });


    jQuery('.wrong').click(function () {
        jQuery(this).hide();
        var cityinput = jQuery('.city-input');
        cityinput.removeAttr('disabled');
        cityinput.val('');
    });


    /*last_tab*/
    $('#question').prop('disabled', true);
    $('.question').hide();
    $(document).on('change', '#category', function () {
        $('#question').children('option').show();
        var currentCategory = $(this).children('option:selected').attr('class');
        $('#question').prop('selectedIndex', 0);
        if (currentCategory == 'init_option') {
            $('#question').prop('disabled', true)
        } else {
            $('#question').prop('disabled', false);
            var needQuestions = $('#question_all').children('option').filter('.' + currentCategory).clone();
            $('#question').html(needQuestions)
            //console.log(needQuestions)
        }
        if (currentCategory == 'custom_question') {
            jQuery('#form-tabs a[href="#consult"]').tab('show');
            jQuery('#category option').removeAttr('selected');
            jQuery('#category option:first-child').attr('selected', 'selected');
            jQuery('#question').attr('disabled', 'disabled');
            //$('#question, #category, .category_title, .question_title').hide();
            //$('.question').show();
            //$('.question_title').text('Задайте свой вопрос:')
        }
    })


    $('#free_consult a').on('click', function () {
        $('#free_quest').focus();
    })


    //Scrolling to Main Form
    $('#quest_jurist').on('click',function(e){
        e.preventDefault();
        $("html, body").animate({ scrollTop: 135 }, 1000);
        $('#form-tabs').find('li').removeClass('active');
        $('#form-tabs').children('li.consult').addClass('active');
        $('.tab-pane').removeClass('active');
        $('#consult').addClass('active');
        $('#free_quest').focus();
    });

    //Scrolling to Main Form (second_tab)
    $('#call_jurist').on('click',function(e){
        e.preventDefault();
        $("html, body").animate({ scrollTop: 135 }, 1000);
        $('#form-tabs').find('li').removeClass('active');
        $('#form-tabs').children('li.callmeback').addClass('active');
        $('.tab-pane').removeClass('active');
        $('#callmeback').addClass('active');
        $('#free_quest').focus();

    });

    //Replacing the Main form area
    $('#replace_val').on('click', function(){
        var bottomValue = $('#bottom_val').val();
        $("html, body").animate({ scrollTop: 135 }, 1000);
        $('#form-tabs').find('li').removeClass('active');
        $('#form-tabs').children('li.consult').addClass('active');
        $('.tab-pane').removeClass('active');
        $('#consult').addClass('active');
        $('#free_quest').val(bottomValue).focus();
    });


});
Ответить с цитированием