【发布时间】:2012-09-13 10:58:30
【问题描述】:
我开发了插件 ascensor.js (http://kirkas.ch/ascensor/) 完全重写它(whitout scrollto 插件)后,我在调整大小功能上遇到了一些错误。
当你这样做时,会有一些反弹效果(chrome),你可以看到其他楼层的一小部分,我知道每个浏览器都有不同的调整大小效果,但我想知道是否有办法修复它。
调整大小效果: Chrome/Safari/Firefox:小反弹,看看其他楼层 Opera:在点击之前没有调整大小的效果
这里是完整的插件:http://kirkas.ch/ascensor/js/jquery.ascensor.js
这里是关于调整大小功能的部分:
function resizeFloor(){
var WW=$(window).width();
var WH=$(window).height()
if(params.Direction=='y'){$(node).stop().animate({scrollTop:(floor-1)*WH},1);}
if(params.Direction=='x'){$(node).stop().animate({scrollLeft:(floor-1)*WW},1);}
if(params.Direction=='chocolate'){
var target = AscensorMap[StageOn-1].split('|');
$(node).stop().animate({
scrollLeft:(target[1]-1)*WW,
scrollTop:(target[0]-1)*WH
},1);
}
$(node).height(WH).width(WW).children(params.ChildType).each(function(){
$(this).height(WH).width(WW);
});
if(params.Direction=='x'){
$(node).children().css('position','absolute');
$(node).children().each(function(index){$(this).css('left',index*WW);})
}
if(params.Direction=='chocolate'){
$(node).children(params.ChildType).each(function(index){
var CoordName = AscensorMap[index].split('|');
$(this).css({'position':'absolute', 'left':(CoordName[1]-1)*WW, 'top':(CoordName[0]-1)*WH});
});
}
}
我也是 JS 开发的新手,所以如果您对语法有任何建议或对系统的批评,我完全开放。
谢谢
【问题讨论】:
标签: jquery resize jquery-animate scrolltop