1

我有一个脚本,如果您在输入字段中输入“61”,它应该四舍五入到“63”,并且它应该显示一个覆盖/div(tooManyFrameprofiles 或 WrongNumberFrameprofiles),但它似乎不会触发“ iPhone 或 Android 上的 focusout" 事件...它在桌面浏览器中完美运行...

脚本如下所示:

$(document).delegate("input.product-quantity-meter", "focusout", function () {

                var number = $(this).val();

                if (parseFloat(number) > 90) {
                    $("body").append("<div class='modal-backdrop fade in'></div>")
                    $("#tooManyFrameProfiles").removeClass("hide fade");
                }

                $("button.without").hide();
                $("button.with").show();

                //Check if number is divisable by 3
                if (number % 3 == 0) {
                    var quantity = number / 3;
                    $("input.product-quantity").val(quantity);
                    var quantityNumber = $("input.product-quantity").val();
                }
                else {
                    // If not diviable by 3, round up number 
                    roundedNumber = round_up(number, 3)

                    $("body").append("<div class='modal-backdrop fade in'></div>")

                    $("#wrongNumberFrameProfiles").removeClass("hide fade");
                    $(this).val(roundedNumber);

                    var quantity = roundedNumber / 3;
                    $("input.product-quantity").val(quantity);
                }
                $("button.close").on('click', function () {
                    $(".modal-backdrop").remove();
                    $("#wrongNumberFrameProfiles").addClass("hide fade");
                    $("#tooManyFrameProfiles").addClass("hide fade");

                    $("button.without").hide();
                    $("button.with").show();
                });
            });
4

0 回答 0