00
00
:
LET'S GO!
Timer
  1. Создали текст для минут и задали ему класс minutes
  2. Создали текст для секунд и задали ему класс seconds
  3. Создали текст для сообщения и задали ему класс fin-txt
  4. Создали кнопку старта и задали ей класс start-timer
<script>
$( window ).load(function() {
    $( '.start-timer' ).click(function(e) {
        let timer = 420; 
        let intervalID = window.setInterval (function(){ 
            timer = timer-1;
            minutes = Math.floor(timer / 60);
            seconds = timer % 60;
            $('.minutes .tn-atom').text(pad2(minutes));
            $('.seconds .tn-atom').text(pad2(seconds));
            if (timer==0) {
                clearTimeout(intervalID);
                $('.fin-txt .tn-atom').text('все- если не получилось, то игра для вас');
            };
        }, 1000);
    });
});

function pad2(num) {
    let s = num.toString();
    return (s.length < 2)? "0" + s : s;
}
</script>

<style>
.start-timer {
    cursor: pointer;
}    
</style>
Digital Storytelling
Tilda Publishing
Digital Storytelling
The Future
<style>
.t694__bg {
    transform: scale(1.2);
}

.t694 .t694__cell:hover .t694__bg {
    transform: scale(1);
}    
</style>

Tilda Newsletter1
Subscribe to our email newsletter for useful tips and valuable resources, sent out every month
Tilda Newsletter2
Subscribe to our email newsletter for useful tips and valuable resources, sent out every month
<script>
$( document ).ready(function() {


function setPrice(){
    let departure = $('select[name="departure"]').val();
    let destination = $('select[name="destination"]').val();
    let rate =  $('select[name="rate"] option:selected').index() + 2;
    let pr = '';
    
    $('.uc-taxi-price .t431__tbody tr').each(function(){
        let tr = $(this);
        let city1 = tr.find('td:eq(0)').text();
        let city2 = tr.find('td:eq(1)').text();
        
        if(city1 == departure && city2 == destination || city2 == departure && city1 == destination ) {
            pr = +tr.find('td:eq('+rate+')').text();
            
            let srv = +$('input[name="services-summ"]').val();
         
            $('input[name="final-price"]').val('Стоимость поездки: '+(pr+srv)+' руб.');
            if(pr===0) $('input[name="final-price"]').val('Уточните у менеджера');
            return false;
        }else{
     
            $('input[name="final-price"]').val('Стоимость поездки: 0 руб.'); 
            if(pr===0) $('input[name="final-price"]').val('Уточните у менеджера');
        };
        

        
    });    
  
};


$(".taxi-form").on('change input', 'select, input[type="checkbox"] ', function() {       
    setTimeout(function(){
        setPrice();
    }, 150);
});   

setTimeout(function(){   setPrice()}, 1000);

$(window).resize(function() {clearTimeout(window.resizedFinished); window.resizedFinished = setTimeout(function(){ setPrice()}, 1000);});

});    
</script>


<style>
.taxi-form .t-input-group_fr {display: none;}

input[name="final-price"] {font-size: 18px !important;font-weight: 600 !important;border: none !important;padding-left: 0;}

.taxi-form .t-form__inputsbox {display: flex;flex-wrap: wrap;justify-content: space-between;}

.taxi-form .t-input-subtitle {height: auto;}

.taxi-form .t-input-group {width: 48%;}

.taxi-form .t-input-group_rd {width: 100%;}

.taxi-form .tn-form__submit {width: 100%;}

.taxi-form .t-checkboxes__wrapper {display: flex;flex-wrap: wrap;justify-content: space-between;}

.taxi-form label.t-checkbox__control {width: 30%;}

@media screen and (max-width:640px){
    .taxi-form .t-form__inputsbox,
    .taxi-form .t-checkboxes__wrapper{
        display:block;
    }
    .taxi-form .t-input-group {
        width: 100%;
}
}
.uc-taxi-price {display:none;}


@media (max-width:640px){
    .taxi-form label.t-checkbox__control {
    width: 100%;
}
}



</style>
Made on
Tilda