我在网页上有几个对话框。代码完成它的工作,但是相当跳跃和故障。我怀疑代码对于ipad来说太重了。
$(document).on("dialogopen", ".dialogClass", function() {
console.log("dlg open");
var parent = $(this).parent();
//$(this).dialog("option", "width", $(window).width());
//$(this).dialog("option", "height", $(window).height());
$(this).dialog("option", "position", [0,0]);
$(this).dialog("option", "draggable", "false");
$(this).dialog("option", "width", $(window).width());
$(this).dialog("option", "height", $(window).height());
parent.css("width", $(window).width());
parent.css("height",$(window).height());
parent.css("position","fixed");
parent.css("top","0px");
parent.css('left','-' + $(window).width() + 'px');
parent.animate({
left: 0
}, speed, "easeOutBounce");
$(this).swipe({
swipeLeft:function(event, direction, distance, duration, fingerCount) {
if(distance >= 200){
var dia = $(this);
$(this).parent().animate({
left : -$(window).width()
},speed, "easeInExpo", function(e) {
dia.dialog("close");
});
}
}
});
});
$(document).on("dialogclose", ".dialogClass", function() {
console.log("dlg close");
//$(this).dialog("destroy");
$(this).swipe("destroy");
$(this).swipe({
swipeLeft:function(event, direction, distance, duration, fingerCount) {
if(distance >= 150){
var dia = $(this);
$(this).parent().animate({
left : -$(window).width()
},speed, "easeInExpo", function(e) {
dia.dialog("close");
});
}
}
});
});
jQuery根本不是处理滑动的正确工具吗?我使用以下jQuery库: