我已将表单嵌入到iScroll4滚动条中。该表单是由wordpress重力表单插件生成的ajax表单。提交ajax表单后iScroll4高度不正确。身高是表单提交前的原始高度
当我点击表单上的提交时,iscroll的高度(在页面加载时生成)保持不变,这意味着如果按下提交按钮后表单较大,则无法一直向下滚动。
见下面我的代码...
var myScroll,
myScrollSidebar;
function loaded() {
myScroll = new iScroll('wrapper');
myScrollSidebar = new iScroll('sidebar-wrapper');
}
var formInputs = [
document.getElementById('gform_submit_button_1'),
document.getElementById('input_1_1'),
document.getElementById('input_1_2'),
document.getElementById('input_1_3'),
document.getElementById('input_1_4'),
document.getElementById('input_input_1_5')
];
for(var i = 0; i < formInputs.length; i++) {
formInputs[i].addEventListener('touchstart' /*'mousedown'*/, function(e) {
e.stopPropagation();
}, false);
}
jQuery(document).bind('gform_page_loaded', function(){
var formInputs = [
document.getElementById('gform_submit_button_1'),
document.getElementById('input_1_1'),
document.getElementById('input_1_2'),
document.getElementById('input_1_3'),
document.getElementById('input_1_4'),
document.getElementById('input_input_1_5')
];
for(var i = 0; i < formInputs.length; i++) {
formInputs[i].addEventListener('touchstart' /*'mousedown'*/, function(e) {
e.stopPropagation();
}, false);
}
});
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
document.addEventListener('DOMContentLoaded', function() { setTimeout(loaded, 200); }, false);
谁能帮我解决这个问题,所以当表单提交,iScroll的高度刷新吧?
绑定的jquery是这样的表单输入工作表单提交后工作。这是因为iscroll4与表单元素的斗争。
在此先感谢。
乔希
您是否尝试过在提交并重新调用'refresh'方法后重新计算表单的高度? – user850234 2012-06-28 18:44:48