以下代码中的所有功能在桌面浏览器上都能正常工作,但在iPad和iPhone上,前2个功能可以工作但第3个(从 $('输入#pagebreakhomeNext')开始。点击( function(){)根本不起作用。
jQuery.noConflict();
jQuery(document).ready(function($){
$('div.rsform-block-pagebreak input').click(function () {
$(window).scrollTop($('div.calculator').offset().top);
return false;
});
$('a#pagebreaksubmitNext').click(function () {
$(window).scrollTop($('div.calculator').offset().top);
return false;
});
$('input#pagebreakhomeNext').click(function () {
if ($('input#postcode').val() != "") {
var code = $('input#postcode').val();
$.ajax({
url: “URL HIDDEN”,
dataType: "json",
data: 'code='+code,
async: false,
success: function(json) {
if((json.found) && $('input.benefits:checked').val() != "I do not get any of these benefits" && $('input.ownership:checked').val() == "Yes" && $('input.insulation:checked').val() == "Yes" && $('input.walls:checked').val() == "Solid Walls" && $('input.houseage:checked').val() == "Between 1930 and 1976") { $('div.rsform-block-success').hide(); $('div.rsform-block-failure').show(); }
else if((json.found) && $('input.benefits:checked').val() != "I do not get any of these benefits" && $('input.ownership:checked').val() == "Yes" && $('input.insulation:checked').val() == "Yes" && $('input.walls:checked').val() == "Solid Walls" && $('input.houseage:checked').val() == "After 1980") { $('div.rsform-block-success').hide(); $('div.rsform-block-failure').show(); }
else { $('div.rsform-block-success').show(); $('div.rsform-block-failure').hide(); }
}
});
}
});
});
请有人帮忙吗?!
答案 0 :(得分:1)
使用" touchstart"事件而不是"点击"。