Показать сообщение отдельно
  #21 (permalink)  
Старый 24.02.2017, 12:24
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,103

MixPetrov,
<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  </style>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
  <script>
$ (function	() {
  function mathC(){
    var nmb = +this.dataset.nmb;
    var ns = +this.value;
    ns = ns || 0;
    ns = Math.ceil(ns/nmb)*nmb;
    this.value = ns
    }
    var timer;
    $('.quantity_cart [type="text"]').on("input", function() {
        window.clearTimeout(timer);
        timer = window.setTimeout(mathC.bind(this), 1200)
    })
});

  </script>
</head>

<body class="quantity_cart">
<input name="1"   size="2" value="1" type="text" data-nmb="3">
<input name="1"   size="2" value="1" type="text" data-nmb="3">
</body>
</html>
Ответить с цитированием