我有一个脚本,如果你在输入字段中输入“61”,它应该向上舍入到“63”,它应该显示overlay / div(tooManyFrameprofiles或WrongNumberFrameprofiles),但它似乎不在iPhone或Android上触发“聚焦”事件......它在桌面浏览器中完美运行......
脚本如下:
$(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();
});
});